generate and test
From: Vincent Penesich (vincent.penesich_at_student.kuleuven.ac.be)
Date: 03/07/05
- Next message: cfp2005_at_micai.org: "[CFP] MICAI-2005, Mexican International conference on ARTIFICIAL INTELLIGENCE (Springer LNAI)"
- Previous message: Djamé Seddah: "Re: swi prolog and odbc connectivity"
- Next in thread: Bart Demoen: "Re: generate and test"
- Reply: Bart Demoen: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: student: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: Vincent Penesich: "Re: generate and test"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 7 Mar 2005 19:12:05 +0100
Hi all,
I'm getting kind of confused here. I seem to not understand the generate and
test paradigm, although I can see how it could be powerful. Suppose I have
this little thingy:
testje(X) :-
genereer(Y),
test(Y),
X = Y.
genereer(Y) :-
Y is random(5).
test(Y) :-
Y > 2.
You probably see my purpose: generate a number, if it's larger than two,
it's ok. But I want Prolog to keep repeating this *until* it is ok. Instead
it just fails. I don't see why it won't try a "redo" in this case. Is there
a way of doing this? I thought that Prolog would try to accomplish the tail
to its best abilities, which means retrying until it is satisfied,
especially since there's a random number generator involved... Any help
would be greatly appreciated.
- Next message: cfp2005_at_micai.org: "[CFP] MICAI-2005, Mexican International conference on ARTIFICIAL INTELLIGENCE (Springer LNAI)"
- Previous message: Djamé Seddah: "Re: swi prolog and odbc connectivity"
- Next in thread: Bart Demoen: "Re: generate and test"
- Reply: Bart Demoen: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: student: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: Brian Hulley: "Re: generate and test"
- Reply: Vincent Penesich: "Re: generate and test"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]