• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

/usr/lib/swipl/library/dcg/high_order.pl
All Application Manual Name SummaryHelp

  • 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
 foreach(:Generator, :Element)// is det
 foreach(:Generator, :Element, :Sep)// is det
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".
ClioPatria (version V3.1.1-51-ga0b30a5)