Did you know ... Search Documentation:
Pack pha -- prolog/library/lazy.pl
PublicShow source

This module provides an alternate implementation of lazy lists where the tail of the list is expanded by a metacall.

llist(A) ---> lnil ; lcons(A, pred(llist(A))).
 head(+List:llist(A), -Head:A) is semidet
 tail(+List:llist(A), -Tail:llist(A)) is semidet
 decons(+List:llist(A), -Head:A, -Tail:llist(A)) is semidet
 repeat(+X:A, -List:llist(A)) is det
Create a list of infinitely repeating X
 take(+N:natural, +L1:llist(A), -L2:llist(A)) is semidet
L2 consists of the first N elements of L1. Traversal of L2 will fail if L1 has fewer than N elements.
 to_llist(+L1:llist(A), -L2:list(A)) is det
Conversion from llist(A) to a Prolog list with delayed tail evaluation.
 to_list(+L1:llist(A), -L2:list(A)) is det
Conversion from llist(A) to a normal, fully evaluated Prolog list.
 map(+P:pred(A,B), +LA:llist(A), -LB:llist(B)) is det
 map(+P:pred(A,B,C), +LA:llist(A), +LB:llist(B), -LC:llist(C)) is det
 member(-X:A, +List:llist(A)) is nondet

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 singleton(Arg1, Arg2)
 empty(Arg1)