diff options
Diffstat (limited to 'parser.prolog')
-rw-r--r-- | parser.prolog | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/parser.prolog b/parser.prolog index c4e0fff..c9f9771 100644 --- a/parser.prolog +++ b/parser.prolog @@ -1,5 +1,5 @@ -:- module(parser, [prompt/1, readList/1, readLine/1, split/2, join/2]). +:- module(parser, [prompt/1, readList/1, readLine/1, split/2, join/2, intercalate/3]). % functions for dealing with lines of text @@ -44,6 +44,13 @@ join([X],R) :- R = X. +intercalate([X|Y], Spacer, Result) :- + intercalate(Y, Spacer, Tail), + atom_concat(X, Spacer, Head), + atom_concat(Head, Tail, Result). +intercalate([X], _, Result) :- Result = X. + + wordList(X) --> whitespace, wordList(X). wordList([X]) --> word(X). wordList([X]) --> word(X), whitespace. |