# Re: solved - Re: pilog question

```Hi Doug,

> Hmmm... the clauses seem paired in like so, in the or/2 reference, like
>
>    (or
>       ((equal 3 @X) (equal @X 4))
>       ((equal 7 @X) (equal @X 7)) )
>
>
> When I similarly pair the clauses of or/2:
>
> (be foo (@N) (or ((a @N) (b @N))))```
```
Right. This is how Pilog (Prolog) works. ;-)

The most fundamental rule is that all clauses in a rule are combined by
an implicit AND:

# 'b' AND 'c' must be true for 'a' to succeed
(be a (@X @Y)
(b @X)
(c @Y) )

To get an OR, you write several rules:

# ('b' AND 'c') OR ('d' AND 'e') must be true for 'a' to succeed
(be a (@X @Y)
(b @X)
(c @Y) )

(be a (@X @Y)
(d @X)
(e @Y) )

Therefore, the 'or' predicate is not really necessary. It is just a
convenience, to avoid defining multiple rules. But from the above it
follows that the each argument clause to 'or' must itself be a list of
clauses:

# ('b' AND 'c') OR ('d' AND 'e') must be true for 'a' to succeed
(be a (@X @Y)
(or
((b @X) (c @Y))
((d @X) (e @Y)) ) )

> Alex, would it be possible to give pilog an and/2 rule similar to the
> or/2 rule that pilog has now?

Now it should be clear that an 'and/2' predicate is superfluous, because
AND is implicit in all Prolog rules.

Cheers,
- Alex
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
```