swipl-devel
swipl-devel copied to clipboard
small glitch in docu of library(dcg/high_order)).
While trying to do protobuf syntax with library(dcg/high_order)) it seems there is small glitch in the docu. It says here:
Element?, (Sep,Element)*
https://www.swi-prolog.org/pldoc/doc_for?object=sequence//3
But what it actually does is this here:
(Element, (Sep,Element)*) ?
Here is some testing. Omitting the first Element and then repeatedly sep with Element doesn't work, thats why the last test case fails. So it must have another specification:
?- phrase(foo(L), [i]).
L = [i].
?- phrase(foo(L), []).
L = [].
?- phrase(foo(L), [i,',',i]).
L = [i, i].
?- phrase(foo(L), [',',i]).
false.
The test code was:
foo(L) --> sequence(bar, baz, L).
bar(i) --> [i].
baz --> [','].