Re: some questions relating pilog

2022-02-15 Thread Alexander Burger
On Tue, Feb 15, 2022 at 06:34:58PM +0100, pd wrote: > > It tries the first one but does not succeed. The second one matches, so the > > others are not tried because of the cut. > > This is interesting, in my understanding when matching the first rule it > should try to unify @C to the result of

Re: some questions relating pilog

2022-02-15 Thread pd
On Sat, Feb 12, 2022 at 8:37 AM Alexander Burger wrote: > > > >(be + (@A @B @C) > > > (^ @C (+ @A @B)) > > > T ) > > > > > >(be + (@A @B @C) > > > (^ @B (- @C @A)) > > > T ) > > I suppose pilog search for rules in order, so the goal (? (+ 3 @X 7)) > > always

Re: some questions relating pilog

2022-02-11 Thread Alexander Burger
Hi pd, > > The environments are nested association lists, with numbers for the levels > > and > > then the symbols for the values at these levels. > > and levels are related to backtracking somehow? Yes. When looking up values for symbols, the symbols at individual levels are unified with

Re: some questions relating pilog

2022-02-11 Thread pd
On Thu, Feb 10, 2022 at 6:27 PM Alexander Burger wrote: > > Could not resist. I elaborated a little :) > > If we define '+' as > >(be + (@A @B @C) > (^ @C (+ @A @B)) T ) > >(be + (@A @B @C) > (^ @B (- @C @A)) T ) > >(be + (@A @B @C) > (^ @A (- @C @B))

Re: some questions relating pilog

2022-02-11 Thread pd
Hi Alex, On Wed, Feb 9, 2022 at 9:53 PM Alexander Burger wrote: > > > > > : (? (factorial @X 120)) > > > > -> NIL > > > > > > How should be declared factorial primitive to be compatible with reverse > > lookup? > > I have not tried. How is it in real Prolog? > In modern prolog you use this

Re: some questions relating pilog

2022-02-10 Thread Alexander Burger
On Wed, Feb 09, 2022 at 09:46:01PM +0100, Alexander Burger wrote: > To take an example a bit simpler than the factorial function, you could start > with addition as: > >(be + (@A @B @C) > (^ @A (- @C @B)) ) > ... Could not resist. I elaborated a little :) If we define '+' as # (+

Re: some questions relating pilog

2022-02-09 Thread Alexander Burger
Hi pd, > > > : (? (factorial @X 120)) > > > -> NIL > > > > This is another issue. This Pilog version of factorial cannot do reverse > > lookup, > > as it calculate numeric values via Lisp calls. > ... > Ok, I suspected that but is there any way to do arithmetic in pilog? My > understanding is

Re: some questions relating pilog

2022-02-09 Thread pd
Hi Alex, thanks for quick reply On Wed, Feb 9, 2022 at 8:13 AM Alexander Burger wrote: > > > Is the reference documentation incorrect? > > No, but it seems that you looked at the reference for pil21. > > The syntax for calling Lisp expressions in Pilog was made a little > friendlier in > pil21,

Re: some questions relating pilog

2022-02-08 Thread Alexander Burger
Hi pd, > I'm using picolisp version 18.12.27 C in a debian 10.10 based distro, > ... > I'm playing with pilog and there're some examples that does not run: > ... >(^ @I (inc @C)) ) > ... > I can make it work if I use the -> functon this way: > ... >(^ @I (inc (-> @C))) ) > > Is the

some questions relating pilog

2022-02-08 Thread pd
Hello, I'm using picolisp version 18.12.27 C in a debian 10.10 based distro, installed as package picolisp 18.12-1 I'm playing with pilog and there're some examples that does not run: 1- the example in doc reference for repeat/0 [1] : : (be integer (@I) # Generate unlimited supply of