SWI-Prolog -- sequence//5

Did you know ... Search Documentation:
SWI-Prolog owl logo Grammar rule sequence//5
Availability::- use_module(library(dcg/high_order)).
Source [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].
Tags are associated to your profile if you are logged in
Tags:
login to add a new annotation post.

AltStyle によって変換されたページ (->オリジナル) /