# Re: How to use Pilog?

```
Alexander Burger wrote:
```
``` Hi Cle,
```
```
Hello Alex,

(...)

Thank you for the list of rules, this will be very helpful :-)

```
``` (be member (@X (@X . @)))
```
```> (be member (@X (@ . @Y)) (member @X @Y))
```
```
(be append (NIL @X @X))
```
```> (be append ((@A . @X) @Y (@A . @Z)) (append @X @Y @Z))

```
Wow, these are very streight forward. I should have anticipated, that (@H . @T) will replace [H|T] in Prolog. This is only logical :-(
```
Thank you!

```
``` (in fact, I copy/pasted that from "lib/pilog.l:117" :-)
```
```
Again another source I will have to dig into :-)

(...)

```
``` 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?
```
```
``` (be mymember (@X @L) (@ = (-> @X) (car (-> @L))))
```
```
```
I guess here, the variable '@' stands only here to allow the Lisp function '=' to be used?
```
```
``` 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?
```
```
``` So it is better to use the standard Prolog method of supplying a
pattern like (@X . @) or (@ . @Y) to split a list, as in the Pilog
clauses above.
```
```
```
Of course! As Pilog is so streight forward, I will use your construction. I like it much better than my attempt. I used it only my way, as I was not aware of the possibility you shown.
```
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.
```
If I use ./dbg, however, all runs as expected :-)

```
``` I really need to document Pilog! I have it on my todo list, but
currently I try to document the database classes first.
```
```
```
This is important as well, of course. Hopefully you wouldn't mind me asking further noob questions about Pilog, though! :-}
```
(...)

Ciao,
Cle.

--------------000706040500020709030403
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
<body text="#000000" bgcolor="#ffffff">
<br>
<br>
Alexander Burger wrote:<br>
<span style="white-space: pre;">&gt; Hi Cle,<br>
</span><br>
Hello Alex,<br>
<br>
(...)<br>
<br>
Thank you for the list of rules, this will be very helpful :-)<br>
<br>
<span style="white-space: pre;">&gt; (be member (@X (@X . @))) </span><br>
&gt; <span style="white-space: pre;"> (be member (@X (@ . @Y)) (member
@X @Y))<br>
&gt; <br>
&gt; (be append (NIL @X @X))</span><br>
&gt;   <span style="white-space: pre;"> (be append ((@A . @X) @Y (@A .
@Z))</span> <span style="white-space: pre;">(append @X @Y @Z))<br>
</span><br>
Wow, these are very streight forward. I should have anticipated, that
(@H . @T) will replace [H|T] in Prolog. This is only logical :-(<br>
<br>
Thank you!<br>
<span style="white-space: pre;"><br>
&gt; (in fact, I copy/pasted that from "lib/pilog.l:117" :-)<br>
</span><br>
Again another source I will have to dig into :-)<br>
<br>
(...)<br>
<br>
<span style="white-space: pre;">&gt; In the second clause you are doing
it halfway correct. (-&gt; @X) is<br>
&gt; the way to access a Pilog binding in a Lisp expression. You can use<br>
&gt; a Lisp expression in a clause if that expression has a variable in<br>
&gt; its CAR, then the CDR should be Lisp. The second clause could be</span><br>
<br>
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?<br>
<br>
<span style="white-space: pre;">&gt; (be mymember (@X @L) (@ = (-&gt;
@X) (car (-&gt; @L))))<br>
</span><br>
I guess here, the variable '@' stands only here to allow the Lisp
function '=' to be used?<br>
<span style="white-space: pre;"><br>
&gt; The third clause, however, is difficult to get straight in this
way,<br>
&gt; as 'mymember' is not a Lisp function.</span><br>
<br>
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?<br>
<br>
<span style="white-space: pre;">&gt; So it is better to use the
standard Prolog method of supplying a<br>
&gt; pattern like (@X . @) or (@ . @Y) to split a list, as in the Pilog<br>
&gt; clauses above.</span><br>
<br>
Of course! As Pilog is so streight forward, I will use your
construction. I like it much better than my attempt. I used it only my
way, as I was not aware of the possibility you shown.<br>
<br>
But another question:<br>
<br>
Is it to be expected, if I start ./p and typing<br>
<br>
(be like (J M))<br>
(? (like @A @B))<br>
<br>
picoLisp seem to run forever? I have to explicitely interrupt it with
^C resulting in a bus error.<br>
<br>
If I use ./dbg, however, all runs as expected :-)<br>
<br>
<span style="white-space: pre;">&gt; I really need to document Pilog! I
have it on my todo list, but <br>
&gt; currently I try to document the database classes first.</span><br>
<br>
This is important as well, of course. Hopefully you wouldn't mind me
<br>
(...)<br>
<br>
Ciao,<br>
Cle.<br>
<br>
</body>
</html>

--------------000706040500020709030403--
--
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
```