More pilog adventures! Alex, would it be possible to give pilog an and/2 rule similar to the or/2 rule that pilog has now? Sometimes refactoring pilog around the lack of an and/2 is a pain. Here's an example, where a rule has a kind of a logical expression (with prolog backup):
holds(A,S) :- restoreSitArg(A,S,F), F ; \+ restoreSitArg(A,S,F), isAtom(A), A. I'd like to do something like: (be holds (@A @S) (or (and (restoreSitArg @A @S @F) (@ solve (list (-> @F)))) (and (not (restoreSitArg @A @S @F)) (isAtom @A) (@ solve (list (-> @A))) ) ) ) Or's ok - but no and. (In pilog.) I think it is fully (?) backtracking over that expression in prolog too. But using a LISP "and" clause in a rule, like this: (@ and (solve ...) (solve ...)) Won't do backtracking over the legs of that (lisp) "and". My solution so far is to make the parts of the conjunction be separate rules to get the desired backtracking: (be holds (@A @S) (or ((holdsRestoreSitArg @A @S @F) (holdsNotRestoreSitArg @A @S @F)))) (be holdsRestoreSitArg (@A @S @F) (restoreSitArg @A @S @F) (@ solve (list (-> @F))) ) (be holdsNotRestoreSitArg (@A @S @F) (not (restoreSitArg @A @S @F)) (isAtom @A) (@ solve (list (-> @A))) ) (The (@ solve (list (-> @x))) -type clause here is trying to treat a naked variable as a rule clause - a workaround because you can't have a pilog variable in place of a rule clause - or at least it doesn't get instantiated like prolog if you try, rather. But this is a separate issue from the and/2 request.) Cheers, Doug -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe