/usr/lib/swipl/library/dcg/high_order.pl
AllApplicationManualNameSummaryHelp

  • library
    • dcg
      • basics.pl -- Various general DCG utilities
      • high_order.pl -- High order grammar operations
        • sequence//2
        • sequence//3
        • sequence//5
        • optional//2
        • foreach//2
        • foreach//3
 sequence(:Element, ?List)// is nondet
Match or generate a sequence of Element. This predicate is deterministic if List is fully instantiated and Element is deterministic. When parsing, this predicate is gready and does not prune choice points. For example:
?- phrase(sequence(digit, Digits), `123a`, L).
Digits = "123",
L = [97] ;
Digits = [49, 50],
L = [51, 97] ;
...