Reputation: 187
I'm running this code:
findall(A, syllable(A), X), nth1(1001,X,B).
syllable returns a valid syllable as a list of sounds. i.e. [e,g,g,s]. I just want to know the 1001st possible syllable, B = [θ,i,p]. And I get that printed to the screen. But after B is shown, prolog shows all of X. Which is approximately 40000 different syllables. This is too much information for me.
How can I hide X from being shown or just have B shown?
Appreciate your help!
Upvotes: 2
Views: 303
Reputation: 60034
make a 'projection':
sy(B) :- findall(A, syllable(A), X), nth1(1001,X,B).
or better, instead of building a full list just to peek one element, define call_nth/2
and then 'jump to' the right solution
?- call_nth(syllable(B), 1001).
Upvotes: 1