> > In the second clause you are doing it halfway correct. (-> @X) is
> > the way to access a Pilog binding in a Lisp expression. You can use
> > a Lisp expression in a clause if that expression has a variable in
> > its CAR, then the CDR should be Lisp. The second clause could be
> Ok, this rule I do not really understand, I think. What other sense does
> it make, to have a Pilog variable in the CAR of a clause, except to
> allow Lisp in its CDR?
Yes, this was the reason for that design decision. This way calling Lisp
functions (e.g. '+') from Pilog is simple and elegant
: (? (@X + 3 4))
> > (be mymember (@X @L) (@ = (-> @X) (car (-> @L))))
> I guess here, the variable '@' stands only here to allow the Lisp
> function '=' to be used?
Yes. It could also be some specific variable like @A, which would then
be bound to the result, but the result of '=' is not of interest here.
> > The third clause, however, is difficult to get straight in this way,
> > as 'mymember' is not a Lisp function.
> Ah okay! Because there is no Pilog variable in the CAR of the clause, I
> cannot use 'car' or 'cdr' in the clause. If, though, I use a dummy
> variable in the CAR to enable Lisp in the CDR, I wouldn't be able to
> call mymember, as it is not a Lisp function, yes?
> But another question:
> Is it to be expected, if I start ./p and typing
> (be like (J M))
> (? (like @A @B))
> picoLisp seem to run forever? I have to explicitely interrupt it with ^C
> resulting in a bus error.
Ah, you found a bug! :-)
In fact, it is not running, but waiting for console input. If you press
Enter, you'll get the correct result.
The problem was the state of the terminal in non-debug mode. The result
was printed, but because the terminal is not in raw mode, the automatic
'flush'ing did not happen. I fixed it now by inserting (flush) after
the output in 'query' ("lib/pilog.l:85)
(print (cdr X))
(T (line)) ) ) )
and uploaded a new "picoLisp.tgz". Thanks for the hint!