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

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
[semidet]sequence(:Start, :Element, :Sep, :End, ?List)//
Match or generate a sequence of Element enclosed by Start end End, where each pair of elements is separated by Sep. More formally, it matches the following sequence:
Start, Element?, (Sep,Element)*, End

The example below matches a Prolog list of integers:

?- phrase(sequence(("[",blanks),
                   number, (",",blanks),
                   (blanks,"]"), L),
                   `[1, 2, 3 ] a`, Tail).
L = [1, 2, 3],
Tail = [32, 97].
ClioPatria (version V3.1.1-40-g9d9e003)