A.13 library(dcg/high_order): High order grammar operations
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(dcg/high_order): High order grammar operations
          • sequence//2
          • sequence//3
          • sequence//5
          • optional//2
          • foreach//2
          • foreach//3
    • Packages
Availability::- use_module(library(dcg/high_order)).
Source[det]foreach(:Generator, :Element)//
[det]foreach(:Generator, :Element, :Sep)//
Generate a list from the solutions of Generator. This predicate collects all solutions of Generator, applies Element for each solution and Sep between each pair of solutions. For example:
?- phrase(foreach(between(1,5,X), number(X), ", "), L).
L = "1, 2, 3, 4, 5".