something is a person if it is either Adam or Eve, or if it has a mother. We can express this in a single rule as follows:

person(X) :- (X=adam; X=eve; mother(X, Y)).

  • Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    5
    ·
    6 days ago

    Yeah, the Y is a wildcard in that position. Typically, you would write it as an underscore, primarily because most Prolog compilers will warn about unknown variables, since those could also just be a typo of an existing variable.