now and again I'd like to use some DCG in SWISH.
With ...
num1 --> [one]|[two]|[three]|[four]|[five].
num2 --> "one"|"two"|"three"|"four"|"five".
... I get:
?- phrase(num1, S).
S = [one] ;
S = [two] ;
S = [three] ;
S = [four] ;
S = [five].
?- phrase(num2, S).
S = [111, 110, 101] ;
S = [116, 119, 111] ;
S = [116, 104, 114, 101, 101] ;
S = [102, 111, 117, 114] ;
S = [102, 105, 118, 101].
50% fine, 50% ... not so fine: I'd much prefer getting answers like `S = [o,n,e]`.
However, it appears to me like `set_prolog_flag(double_quotes, chars)` is not allowed in sandboxed mode... what can I do? Options? Workarounds? Hacks?
Best Regards,
Stefan.
One way out might be to load library files always with the system
default settings. This is similar to the fact that library files
get their global operators and predicates from `system` instead of
`user` to avoid user declarations from breaking the libraries.