Re: Request for app development feedback/help
Thanks Alex, So, would you suggest that I familiarize myself with prolog before venturing deeper into app development in picolisp? I think it will be helpful for me if I could get an english translation of this? (? @Nr (and *CuSuNr (cons @ T)) @Nm *CuSuNm @Tel *CuSuTel @Plz *CuSuPlz @Ort *CuSuOrt @Mob *CuSuMob (select (@@) ((nr +CuSu @Nr) (nm +CuSu @Nm) (tel +CuSu @Tel) (plz +CuSu @Plz) (ort +CuSu @Ort) (mob +CuSu @Mob) ) (range @Nr @@ nr) (tolr @Nm @@ nm) (fold @Tel @@ tel) (head @Plz @@ plz) (part @Ort @@ ort) (fold @Mob @@ mob) ) ) Regards, Kashyap On Mon, Oct 21, 2019 at 10:00 AM Alexander Burger wrote: > On Mon, Oct 21, 2019 at 07:12:32AM -0700, C K Kashyap wrote: > > Finally - its good to see the values :) ... I used (show @@). > > I see, so @@ is just a "variable" introduced in the select function - i > got > > a little confused by (@@) - I thought it was a function call - but looks > > like select takes the argument unevaluated :) (love the (vi 'select) ) > > We cannot talk about "evaluation" in Pilog, as this is no Lisp despite it > uses > s-expressions. > > It is all about "unification", i.e. values are matched with patterns > containing > variables. And a variable is recognized by Pilog because it starts with > "@". In > real Prolog variables are recognized because they start with an uppercase > letter. > > > > I noticed that the variable name has to start with @ - It does not work > if > > I use a name without @ - why is that? > > Exactly. This is how Prolog works. Perhaps you may want to look at some > intro > like https://www.metalevel.at/prolog - Prolog is a beast very different > from > other languages. > > > Also, I noticed that functions in the > > form library have their parameter names in the string format (for > example (de > > form ("Attr" . "Prg")) - I am curious about that too. > > These are transient symbols used for privacy. See > https://software-lab.de/doc/faq.html#problems > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Request for app development feedback/help
On Mon, Oct 21, 2019 at 07:12:32AM -0700, C K Kashyap wrote: > Finally - its good to see the values :) ... I used (show @@). > I see, so @@ is just a "variable" introduced in the select function - i got > a little confused by (@@) - I thought it was a function call - but looks > like select takes the argument unevaluated :) (love the (vi 'select) ) We cannot talk about "evaluation" in Pilog, as this is no Lisp despite it uses s-expressions. It is all about "unification", i.e. values are matched with patterns containing variables. And a variable is recognized by Pilog because it starts with "@". In real Prolog variables are recognized because they start with an uppercase letter. > I noticed that the variable name has to start with @ - It does not work if > I use a name without @ - why is that? Exactly. This is how Prolog works. Perhaps you may want to look at some intro like https://www.metalevel.at/prolog - Prolog is a beast very different from other languages. Also, I noticed that functions in the > form library have their parameter names in the string format (for example (de > form ("Attr" . "Prg")) - I am curious about that too. These are transient symbols used for privacy. See https://software-lab.de/doc/faq.html#problems ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Request for app development feedback/help
Finally - its good to see the values :) ... I used (show @@). I see, so @@ is just a "variable" introduced in the select function - i got a little confused by (@@) - I thought it was a function call - but looks like select takes the argument unevaluated :) (love the (vi 'select) ) I noticed that the variable name has to start with @ - It does not work if I use a name without @ - why is that? Also, I noticed that functions in the form library have their parameter names in the string format (for example (de form ("Attr" . "Prg")) - I am curious about that too. Regards, Kashyap On Mon, Oct 21, 2019 at 6:42 AM Alexander Burger wrote: > On Mon, Oct 21, 2019 at 06:16:41AM -0700, C K Kashyap wrote: > > Thank you Alex, > > I get the following when I run the (?) - for which I defined a function > XX. > > Good. > > > I do see that I get back 1 record when *CuSuNm is "Oaks" and 3 records > when > > *CuSuNm is "". However, I don't see the actual values - except for @Nm. > > > @Nr=NIL @Nm="Oaks" @Tel=NIL @Plz=NIL @Ort=NIL @Mob=NIL @@={C2} > > Yes. '?' shows all unified Pilog variables. As the object is bound to > '@@', we > see '{C2}' but that's not so very helpful. > > You can use the 'show' predicate to view them: > >: (? ... (select (@@) ...) (show @@)) > > or pick individual properties > >: (? ... (select (@@) ...) (val @Nm @@ nm) (val @Tel @@ tel)) > > then '@Nm' and '@Tel' will be unified to the proper values and shown in the > results. > > > > While at it, could you also explain the @/@@ convention? Is there a doc I > > could read for this? > > '@@' is just the implicit variable used in the GUI. Outside of GUI usage > you can > use any name, e.g. > >: (? ... (select (@CuSu) ... > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Request for app development feedback/help
On Mon, Oct 21, 2019 at 06:16:41AM -0700, C K Kashyap wrote: > Thank you Alex, > I get the following when I run the (?) - for which I defined a function XX. Good. > I do see that I get back 1 record when *CuSuNm is "Oaks" and 3 records when > *CuSuNm is "". However, I don't see the actual values - except for @Nm. > @Nr=NIL @Nm="Oaks" @Tel=NIL @Plz=NIL @Ort=NIL @Mob=NIL @@={C2} Yes. '?' shows all unified Pilog variables. As the object is bound to '@@', we see '{C2}' but that's not so very helpful. You can use the 'show' predicate to view them: : (? ... (select (@@) ...) (show @@)) or pick individual properties : (? ... (select (@@) ...) (val @Nm @@ nm) (val @Tel @@ tel)) then '@Nm' and '@Tel' will be unified to the proper values and shown in the results. > While at it, could you also explain the @/@@ convention? Is there a doc I > could read for this? '@@' is just the implicit variable used in the GUI. Outside of GUI usage you can use any name, e.g. : (? ... (select (@CuSu) ... ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Request for app development feedback/help
Thank you Alex, I get the following when I run the (?) - for which I defined a function XX. I do see that I get back 1 record when *CuSuNm is "Oaks" and 3 records when *CuSuNm is "". However, I don't see the actual values - except for @Nm. While at it, could you also explain the @/@@ convention? Is there a doc I could read for this? : (setq *CuSuNm "Oaks") -> "Oaks" : (XX) @Nr=NIL @Nm="Oaks" @Tel=NIL @Plz=NIL @Ort=NIL @Mob=NIL @@={C2} -> NIL : (setq *CuSuNm "") -> NIL : (XX) @Nr=NIL @Nm=NIL @Tel=NIL @Plz=NIL @Ort=NIL @Mob=NIL @@={C1} @Nr=NIL @Nm=NIL @Tel=NIL @Plz=NIL @Ort=NIL @Mob=NIL @@={C2} @Nr=NIL @Nm=NIL @Tel=NIL @Plz=NIL @Ort=NIL @Mob=NIL @@={C3} -> NIL : Regards, Kashyap On Mon, Oct 21, 2019 at 4:09 AM Alexander Burger wrote: > Hi Kashyap, > > > While I see the big pieces based on the description given in > doc/app.html, > > I need some help understanding the Pilog queries. > > > > I think I can make progress if I could figure out how to run the pilog > > queries in the sample app on the REPL. For example, how can I run the > pilog > > query in the choOrd function in app/gui.l. > > The easiest is to use the '?' function to test Pilog queries interactively. > > For example, after setting some globals, eg. > >: (setq *CuSuNm "Oaks") > > you can paste the whole query > >: (? > @Nr (and *CuSuNr (cons @ T)) > @Nm *CuSuNm > @Tel *CuSuTel > @Plz *CuSuPlz > @Ort *CuSuOrt > @Mob *CuSuMob > (select (@@) > ((nr +CuSu @Nr) (nm +CuSu @Nm) (tel +CuSu @Tel) > (plz +CuSu @Plz) (ort +CuSu @Ort) (mob +CuSu @Mob) ) > (range @Nr @@ nr) > (tolr @Nm @@ nm) > (fold @Tel @@ tel) > (head @Plz @@ plz) > (part @Ort @@ ort) > (fold @Mob @@ mob) ) ) > > and then step through the results with . > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: Request for app development feedback/help
Hi Kashyap, > While I see the big pieces based on the description given in doc/app.html, > I need some help understanding the Pilog queries. > > I think I can make progress if I could figure out how to run the pilog > queries in the sample app on the REPL. For example, how can I run the pilog > query in the choOrd function in app/gui.l. The easiest is to use the '?' function to test Pilog queries interactively. For example, after setting some globals, eg. : (setq *CuSuNm "Oaks") you can paste the whole query : (? @Nr (and *CuSuNr (cons @ T)) @Nm *CuSuNm @Tel *CuSuTel @Plz *CuSuPlz @Ort *CuSuOrt @Mob *CuSuMob (select (@@) ((nr +CuSu @Nr) (nm +CuSu @Nm) (tel +CuSu @Tel) (plz +CuSu @Plz) (ort +CuSu @Ort) (mob +CuSu @Mob) ) (range @Nr @@ nr) (tolr @Nm @@ nm) (fold @Tel @@ tel) (head @Plz @@ plz) (part @Ort @@ ort) (fold @Mob @@ mob) ) ) and then step through the results with . ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Unsubscribe
Good bye Mark Probert :-( You are now unsubscribed -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe