I'm using Teyjus for programming in Lambda Prolog. I have this simple lists generator:
type islist int -> list X -> o.
islist N nil
:- N >= 0.
islist N (H::T)
:- N >= 0,
M is N - 1,
islist M T.
I need to create a predicate that return a list made of all lists generated by islist within a certain bound.
I thought to proceed with Failure driven loop. For the moment I can only print lists generated with the following code:
type loop int -> o.
loop N
:- islist N L,
term_to_string L STR,
print STR,
print "\n",
fail.
loop _.
What I need is to collect these lists not print them (so I need something like a list comprehension). How can I do it?