Hi all,

since version 21.7.25 PicoLisp supports a new syntax for calling Lisp code in
Pilog rules.

As before, the predicate '^' evaluates Lisp expressions inside Pilog code:

   : (? (^ @X (println 'OK)))
   OK
    @X=OK

Traditionally, Pilog variables can be accessed with the '->' function:

   : (? @A 3
      (^ @B (inc (-> @A))) )
    @A=3 @B=4

   : (? @A 3 @B 4
      (^ @N (* (+ (-> @A) (-> @B)) (- (-> @A) (-> @B)))) )
    @A=3 @B=4 @N=-7

Now these variables are automatically *bound* before the Lisp code is evaluated,
so that the following works:

   : (? @A 3
      (^ @B (inc @A)) )
    @A=3 @B=4

   : (? @A 3 @B 4
      (^ @N (* (+ @A @B) (- @A @B))) )
    @A=3 @B=4 @N=-7

The new syntax is shorter and a lot more readable.

The old syntax continues to work, and '->' is till needed for calls like

   (-> @A 3)

to access non-top-level Pilog environments.

☺/ A!ex

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

Reply via email to