[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'once' predicate..
From: |
Henk Vandecasteele |
Subject: |
Re: 'once' predicate.. |
Date: |
Tue, 05 Nov 2002 09:52:58 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 |
Dear,
once/1 should behave identical as with the definition:
once(Goal):- call(Goal), !.
or identical
once(Goal):- call(Goal) -> true.
Of course the compiler can optimise the call to once/1 to avoid the
metacall.
You can use the once/1 predicate when you are only interested in the
first solution of a call to a predicate. And thus avoid unnecesary
backtracking.
Regards,
Henk
Abhinav-Bhardwaj wrote:
hi,
can anybody explain what is 'once' predicate, and where it is
most commonly applied ?
thanks and regards,
Abhinav
_______________________________________________
Users-prolog mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/users-prolog
- 'once' predicate.., Abhinav-Bhardwaj, 2002/11/05
- Re: 'once' predicate..,
Henk Vandecasteele <=