I think James Patterson wrote: > Hello, are there any performance or whatever issues with choosing to use > (not (some-pattern (field ?x)) versus (some-pattern (field ~?x)), or > (some-pattern (field ?f&:(neq ?f ?x))), where ?x has been previously > defined? > > Thanks, > James >
(some-pattern (field ~?x)) and (some-pattern (field ?f&:(neq ?f ?x))) mean exactly the same thing: there is a fact of type "some-pattern" whose slot named "field" contains a value that is not ?x. This pattern can match multiple times if there are multiple such facts. The first version is a little bit more efficient, because the second has the overhead of an explicit function call (that much should be pretty obvious.) (not (some-pattern (field ?x))) means something rather different: It means there is no some-pattern fact whose "field" slot contains ?x. There might be no some-pattern facts at all, or there might be some-pattern facts with non-?x values in "field." This pattern can match only once: either there is such a fact, or there is not. You can't really compare the performance of the first two patterns with this one, becuse they're asking completely different questions. There's no reason to avoid one locution relative to the other -- just make sure you're saying what you mean to say. There is a fourth alternative you might throw into the comparison: (exists (some-pattern (field ~?x))). This matches when there is at least one some-pattern whose field slot is not ?x. It can only match once, even if there are multiple such facts. --------------------------------------------------------- Ernest Friedman-Hill Distributed Systems Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
