Alexander Burger wrote:
Hi Cle,

Hi Alex,

I have now defined a small helper clause:

     (be for (@H (@H . @)))
     (be for (@E (@ . @T)) (for @E @T))

Good idea!

thank you ... :-)

There is a rule 'lst' in "lib/pilog.l" which does the same. But 'for' is
a much better name. Too bad! I didn't think about that. But now it is
too late to change, 'lst' is used in too many places.

Ah, this did not occur to me. Okay I will have a look and perhaps use 'lst' if it is already there :-)

I try to read pilog.l before I ask questions, but I have to admit, it is still a bit difficult to understand for me right now. Perhaps it will get easier eventually if I reach a certain level of understanding :-)

Another question arose yet. I try to find an equivalent of Prolog's findall/3 predicate. I guess, I can use the Lisp function 'solve' for this purpose, yes?

If I read the signature of 'solve' I find:

   (de solve ("CL" . "Prg") ...)

For what is the "Prg" standing here? I assumed I can put a Lisp command list here, but this does not seem to work and the interpreter is aborting with a bus error. The only thing I could get to work, would be something like:

  (solve '( (myPred @Var1 @Var2) ) @Var1)

That seem to collect all solutions (with variable bindings) of 'myPred' and filter that list for '@Var1' alone. But the name of the argument "Prg" irritates me a bit; doesn't it stand for Program?

Further: 'solve' seem to return a list of all solutions, whereas 'pilog' seem to return only the last result of all solutions. Is this correct?

(...)

Unfortunately not. This is perhaps the reason why 'lst' is defined in a
non-recursive way, calling the Lisp 'pop' function.

And therefore I will use 'lst' instead my home-grown 'for' predicate ... :-)

Ah, still another think I wonder ... during reading of pilog.l I found several occurrences of '(repeat)' within that file. What purpose do they serve? They seem to play together with 'be' but I cannot really grasp its purpose probably, I think. It seems only to be a shortcut for a self repeating clause, doesn't it? So is

   (be repeat)
   (repeat)

is equivalent with

  (be repeat)
  (be repeat () (repeat))

? Is this is the only purpose of the Lisp 'repeat'?

(...)


Ciao,
Cle.


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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
<br>
Alexander Burger wrote:
<blockquote cite="mid:20091125093436.ga27...@software-lab.de"
type="cite">
 <pre wrap="">Hi Cle,
 </pre>
</blockquote>
<br>
Hi Alex,<br>
<br>
<blockquote cite="mid:20091125093436.ga27...@software-lab.de"
type="cite">
 <blockquote type="cite">
   <pre wrap="">I have now defined a small helper clause:

   (be for (@H (@H . @)))
   (be for (@E (@ . @T)) (for @E @T))
   </pre>
 </blockquote>
 <pre wrap=""><!---->
Good idea!
 </pre>
</blockquote>
<br>
thank you ... :-)<br>
<br>
<blockquote cite="mid:20091125093436.ga27...@software-lab.de"
type="cite">
 <pre wrap="">There is a rule 'lst' in "lib/pilog.l" which does the same. But 
'for' is
a much better name. Too bad! I didn't think about that. But now it is
too late to change, 'lst' is used in too many places.
 </pre>
</blockquote>
<br>
Ah, this did not occur to me. Okay I will have a look and perhaps use
'lst' if it is already there :-)<br>
<br>
I try to read pilog.l before I ask questions, but I have to admit, it
is still a bit difficult to understand for me right now. Perhaps it
will get easier eventually if I reach a certain level of understanding
:-)<br>
<br>
Another question arose yet. I try to find an equivalent of Prolog's
findall/3 predicate. I guess, I can use the Lisp function 'solve' for
this purpose, yes?<br>
<br>
If I read the signature of 'solve' I find:<br>
<br>
   (de solve ("CL" . "Prg") ...)<br>
<br>
For what is the "Prg" standing here? I assumed I can put a Lisp command
list here, but this does not seem to work and the interpreter is
aborting with a bus error. The only thing I could get to work, would be
something like:<br>
<br>
  (solve '( (myPred @Var1 @Var2) ) @Var1)<br>
<br>
That seem to collect all solutions (with variable bindings) of 'myPred'
and filter that list for '@Var1' alone. But the name of the argument
"Prg" irritates me a bit; doesn't it stand for Program?<br>
<br>
Further: 'solve' seem to return a list of all solutions, whereas
'pilog' seem to return only the last result of all solutions. Is this
correct?<br>
<br>
(...)<br>
<br>
<blockquote cite="mid:20091125093436.ga27...@software-lab.de"
type="cite">
 <pre wrap="">Unfortunately not. This is perhaps the reason why 'lst' is 
defined in a
non-recursive way, calling the Lisp 'pop' function.
 </pre>
</blockquote>
<br>
And therefore I will use 'lst' instead my home-grown 'for' predicate
.. :-)<br>
<br>
Ah, still another think I wonder ... during reading of pilog.l I found
several occurrences of '(repeat)' within that file. What purpose do
they serve? They seem to play together with 'be' but I cannot really
grasp its purpose probably, I think. It seems only to be a shortcut for
a self repeating clause, doesn't it? So is<br>
<br>
   (be repeat)<br>
   (repeat)<br>
<br>
is equivalent with<br>
<br>
  (be repeat)<br>
  (be repeat () (repeat))<br>
<br>
? Is this is the only purpose of the Lisp 'repeat'?<br>
<br>
(...)<br>
<br>
<br>
Ciao,<br>
Cle.<br>
<br>
</body>
</html>

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

Reply via email to