Programming challenge: wildcard exclusion in cartesian products
sRuEmMrOnVoEt at hotmail.com
Tue Mar 21 20:02:43 CET 2006
<wkehowski at cox.net> wrote in message
news:1142925259.468795.104500 at t31g2000cwb.googlegroups.com...
> After the basic fact of generating the exclusion - a considerable
> achievement - the program should be interactive. What if the target set
> has thousands or millions of elements? There should be a loop-like way
> ('do' in Haskell, for example) to peel off the elements one-by-one and
> then terminate.
1 ?- generate_member(X,[1,2],3,[[and, [*,2], [or, [2,1,*], [1,2,*]]]]),
write(X),nl,write('Is this the term you were looking for? (y/n):'),
get(Y), ((Y is 121) -> true; fail). % 121 = 'y'
[1, 1, 1]
Is this the term you were looking for? (y/n):n
[1, 1, 2]
Is this the term you were looking for? (y/n):|: n
[1, 2, 1]
Is this the term you were looking for? (y/n):|: y
More information about the Python-list