Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math

Topic: PROLOG does SO have NOT() !!
Replies: 3   Last Post: Nov 20, 2012 3:33 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Graham Cooper

Posts: 4,343
Registered: 5/20/10
Re: PROLOG does SO have NOT() !!
Posted: Nov 20, 2012 4:21 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

> A predicate with more than 2 values!
>
> gender(m).            1
> gender(f).                2
> not(gender(X)).         3
>
> Prolog searches for a match from top to bottom,
> it will return
> --> gender(m)
>
> or
> --> not(gender(t)).
>
> for any value other than m or f!
>



Correction... it will match X to 'm' or 'f' if you search for
not(gender(m))

You have to specify the final option(s).

gender(m).
gender(f).
not(gender(t)).
not(gender(o)).

Herc



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.