Did you know ... | Search Documentation: |
Pack dcg_extras -- prolog/dcg_extras.pl |
Taken from The Power of Prolog by Markus Triska
It's recommended to set the flag to write lists of characters as strings:
:- set_prolog_flag(double_quotes, chars).
?- phrase(("Hello, ",seq(Cs),"!"), "Hello, all!"). Cs = "all" ; false.
?- phrase(seqq(["ab","cd","ef"]), Ls). Ls = "abcdef".
?- phrase((...,"you",...,"!"), "Hello, you all!"). true ; false.