Anyone knows why t2/2
doesn’t terminate? Note that t2/2
uses blanks//0
instead of blank//0
.
:- use_module(library(dcg/high_order)).
:- use_module(library(dcg/basics)).
t1(List) :-
Str = `this is a test`,
phrase( (sequence(nonblanks,blank,List)),
Str).
t2(List) :-
Str = `this is a test`,
phrase( (sequence(nonblanks,blanks,List)),
Str).
Query:
7 ?- t1(L).
L = [[116, 104, 105, 115], [105, 115], [97], [116, 101, 115, 116]].
8 ?- t2(L).
% doesn't terminate