Hi Eric,

> (be underage (@X)
>   (age @X @Y)
>   (< @Y 18))

'<' is a Lisp function and not a Pilog rule. To embed a Lisp expression
in Pilog, you must use the '^' operator. It causes the rest of the
expression to be taken as Lisp, and inside the Lisp code you can in turn
access Pilog-bindings with the '->' function.

In the case above it should be something like

   (^ @ (< (-> @Y) 18))

'@' is an anonymous variable here. If you want to bind the result of the
Lisp expression to a specific variable, it would be e.g.

   (^ @X (+ (-> @N) 7))

This binds @X to @N + 7.


Of course, if you need '<' more often, you could define your own
predicate:

   : (be < (@A @B)
      (^ @ (< (-> @A) (-> @B))) )
   -> <

   : (? (< 3 4))
   -> T

   : (? (< 4 2))
   -> NIL

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to