beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
seninha has quit [Quit: Leaving]
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
rob_w has joined #picolisp
seninha has joined #picolisp
chexum has quit [Remote host closed the connection]
chexum has joined #picolisp
jmarciano has joined #picolisp
<jmarciano> may somebody experienced with PicoLisp tell me if (*) returning NIL in PicoLisp is obstacle or feature? It is because I am trying to find use of the function in other Lisp where (*) ➜ 1, however, apparently, the use for it does not exist. I have found PicoLisp returning NIL on empty (*)
<jmarciano> Was author of PicoLisp aware that other Lisp return (*) ➜ 1 at time of making it?
<jmarciano> And what was decision of author, reasoning, why not to include it?
<abu[m]> Hi jmarciano! Well, I'm the author.
<jmarciano> Which reasoning I favor, as I rather like NIL returned, rather than finding out where did I miss to place the numbers.
<jmarciano> Nice to meet you.
<abu[m]> It is a "feature" that NIL propagates through arithmetics
<jmarciano> How does it help instead of providing identity elements?
<abu[m]> (*) especially was not contemplated though, it is a pretty useless call
<abu[m]> but (+ 3 NIL) -> NIL was desired
<jmarciano> and why?
<jmarciano> Were you aware at the time of authoring it, that other Lisp was giving (*) ➜ 1
<abu[m]> It is very convenient. I think I have hundreds of cases where I rely on getting NIL when not all argumets are ready (yet)
<abu[m]> very common in valuen from GUI
<abu[m]> A was not aware
<abu[m]> and never cared about other Lisps
<jmarciano> (*) ➜ 1, (+) ➜ 0, (-) ➜ 0, that is in Emacs Lisp
<abu[m]> Note that PicoLisp is very different from most Lisps anywad
<abu[m]> What is a call like (*) useful for?
<jmarciano> That is fine. I just encountered zealous handling of my question in Emacs Lisp, that was my question
<jmarciano> And people tried explaining it and explaining it, and justifying it, but nobody can find program that would break if that function would ask for 2 factors as arguments.
<jmarciano> May I copy this text above this line to mailing list?
<abu[m]> I see, ok
<abu[m]> Sure, no problem
<jmarciano> Thanks
<abu[m]> Arithmetics in Pil take normally 1 to infinite args I think
<jmarciano> Personally I like to get error if I write something like (+ (* 3 1) (*) (* 2 2))
<jmarciano> If I do not get error, I may assume in programming that all is fine, but I may not find again (*) easily
<jmarciano> If I however, get error, I find it practical.
<abu[m]> Yeah, but an error may also be inconvenient (eg in above GUI cases)
<jmarciano> (+ (*) (*) (*)) ➜ 3
<abu[m]> The pil docs say that NIL is regarded as NaN in arithmetics iirc
<abu[m]> NaN also propagates in some systems
<abu[m]> (with floats)
<abu[m]> If you want an error if any of ther args was NIL, you just need to check the final result
<jmarciano> OK
<abu[m]> otherwise, if you want to allow NIL, you would have to check before *every* subexpression
<jmarciano> I would have another question.
<jmarciano> pil supports PostgreSQL I guess.
<jmarciano> When you mention GUI in PicoLisp, do you mean the web GUI?
<abu[m]> There is no built-in support for any external DB
<abu[m]> and yes, the web gui
<abu[m]> Pil's DB is built in, with first class objects
<jmarciano> Aha it uses own database, this I understand. But there are external PostgreSQL packages, are they?
<jmarciano> Is it the only GUI?
<abu[m]> I have not heard about libraries for other DBs. If you have a DB with a 'C' API, it is very easy to access it with native calls though
<jmarciano> I understand that.
<abu[m]> Over the time there were other GUIs, i.e X11 lib, Motiv, curses, Java AWT
<abu[m]> but in the distro there are now only the web things
<abu[m]> and @lib/android.l
<abu[m]> for the Android toolbox
<jmarciano> I understand.
<jmarciano> > > Did you see reference to PicoLisp?
<jmarciano> >
<jmarciano> >
<jmarciano> > -> NIL
<jmarciano> > Yes, and I think it's seriously wrong with
<jmarciano> > : (+)
<jmarciano> >
<jmarciano> > where its docs say
<jmarciano> >
<jmarciano> > Returns the sum of all num arguments. When one of the arguments
<abu[m]> Which GUI do you have in mind? Gnome?
<jmarciano> Do you think personally that docstring is wrong there?
<jmarciano> In my work I like to have something similar to spreadsheet like screen, with rows and columns, and that I can assign key bindings which would be different depending of the database table, to be invoked in each specific row.
<abu[m]> What do you mean with "wrong there?
<jmarciano> It is not me, it is participant saying it is wrong.
<abu[m]> Docstring is fine, though I don't use it
<abu[m]> A spreadsheet-like GUI I did in several projects using the normal web gui
<abu[m]> with the +Chart classes
<jmarciano> WEB gui is dependent on browser, I have used similar for decade and more, then I switched to using Emacs tabulated-list-mode
<jmarciano> Though if there would be spreadsheet only toolkit or similar, speedy, I would use such.
<abu[m]> The pil gui does not depend on any browser
<jmarciano> Thanks I will look into it
<abu[m]> it even works in text browsers like w3m
<abu[m]> Thanks for the link to the emacs list!
<jmarciano> Apparently (*) ➜ 1 was like this since MacLisp or before, I am trying to find out why, in practical sense only.
<jmarciano> While people are trying to explain about set theory, identity elements, etc. but there is no practical use that I could find.
<jmarciano> And it just pisses people off because I kept asking.
<jmarciano> Which is not my intention, I just tried to understand.
<abu[m]> Maybe not for practical use, but formal "correctness"
<abu[m]> (*) -> 1 and (+) -> 0 are the unities kind of
<jmarciano> Identity element - Wikipedia:
<abu[m]> yes, I meant identity, not unity
<jmarciano> however, identity element must be added to something that result remains same, and here we have case of absence of arguments, not existence of arguments, but okay, I would not like that story getting into this space
<abu[m]> The reason in Pils thinking is that usually a missing argument is NIL
<abu[m]> So (*) is (* NIL ...)
<abu[m]> Ergo it gives NIL
<abu[m]> There is no special code internally checking this, it is an automatic result of the underlying principles
<abu[m]> BTW, you asked to post this to the emacs list. You know that there is a log of this at https://libera.irclog.whitequark.org/picolisp ?
<jmarciano> And it is "surprise" when I this is shown to work in PicoLisp (apply '* '(1 2 3))
<jmarciano> even this (apply '* '(1))
<jmarciano> (apply '* '())
<jmarciano> -> NIL
<jmarciano> However in Emacs (apply '* '()) ➜ 1
<jmarciano> I was not aware, I don't mind that it is logged.
<abu[m]> ok :)
<abu[m]> BTW, neither * nor (1 2 3) needs to be quoted in Pil
<abu[m]> (apply * (1 2 3))
<abu[m]> Ah, I meant you can mail the URL of the log instead of the text
<jmarciano> Aha alright
<jmarciano> Yes all are functions
<jmarciano> There is no need for quoting?
<jmarciano> Quoting is not quite conformant to "list" principle.
<abu[m]> A symbol whose value is a function evaluates to that function
<jmarciano> (quote 1 2 3) could as well be shown as (' 1 2 3) instead of '(1 2 3), so that everything is embraced with parenthesis
<abu[m]> and a list starting with a *number* auto-quotes
<jmarciano> Yes, I see simplicity
<jmarciano> Is there picolisp mode for evaluation inside of Emacs?
<jmarciano> Or I just change inferior lisp to PicoLisp?
<jmarciano> I was doing it before in exercises
<abu[m]> There is (a bit outdated I think) some emacs lib for Pil, but I do not know it well
<abu[m]> Seems to work though, there was some discussion recently in the PicoLisp mailing list
<abu[m]> It was maintained by Thorsten Jolitz
<jmarciano> Is there any online example of GUI, apart from smaller examples from the package?
<jmarciano> I was using this one:
<jmarciano> GeDaFe - PostgreSQL Generic Database Interface:
<jmarciano> I can't switch from PostgreSQL to some other database.
<jmarciano> That is how it looked like, but that can't solve my needs, I may have 20 functions that I have to run on a single line, for example to e-mail the entry to sombody, share to XMPP, invoke a call, that can't work through WWW interface due to browser limitations
<abu[m]> I think interfacing to Postgres is not so difficult
<abu[m]> What APIs are available?
<abu[m]> But surely directly in Pil it is a lot easier
<jmarciano> I think that by demonstration of PicoLisp on Android, I could build for example, forms, that can be completed by agent on the field, and sent, right? DB can be sent?
<abu[m]> Sent to where?
<jmarciano> PostgreSQL has C interface, how it works, I have no idea as I always worked on higher level, but I understand that PicoLisp can access C functions. I am just worried of representations.
<abu[m]> My above link was wrong
<jmarciano> If PicoLisp could maybe share DB to people, let us say by e-mail.
<abu[m]> A simple DB demo is at https://software-lab.de/app.tgz
<abu[m]> Also testable at https://picolisp.com/app
<jmarciano> As entering forms on mobile phone need not depend on WWW interface, I would rather like shipping DB through SSH.
<abu[m]> You want to send a DB by mail?
<jmarciano> What is username/password?
<abu[m]> Usually I have reports in applications
<jmarciano> Yes, of course, after entering of information in PicoLisp I have to transfer information.
<abu[m]> you can export CSV then
<jmarciano> If that CSV is easily importable, then yes, I would prefer SEXP format.
<abu[m]> The DB is binary, and too large normally to send
<abu[m]> A graph of objects
<jmarciano> okay i can explore it
<jmarciano> What is username/password?
<abu[m]> The demo uses admin / admin
<abu[m]> There was also some docs iirc
<jmarciano> I am exploring selections like "prefix" Herr
<jmarciano> You see, I would have selections with 50000+ objects
<abu[m]> a bit outdated perhaps
<jmarciano> It becomes not practical in WWW area
<abu[m]> If you click on Customers/Suppliers, you see that it has 96000 objects
<abu[m]> 96,055
<abu[m]> all nonsense addresses, generated by random for demo purposes
<jmarciano> Yes
<jmarciano> I am trying search, is not working
<abu[m]> in Customers?
<jmarciano> Somehow sluggish, now it started working
<abu[m]> The search keys on top are used with a logical AND
<jmarciano> I understand concepts
<abu[m]> ok
<abu[m]> The TGZ link above holds the sources of this demo app
<jmarciano> I will try it out
<abu[m]> You can install it locally and play around
<jmarciano> Thanks so far! Must go outside to handle things, then come back later.
<abu[m]> Good! ☺
<abu[m]> I must go too
<jmarciano> I would like making application on Android, which can accept objects from other applications, like capturing them.
<abu[m]> Interesting, let's talk about it later
jmarciano has quit [Ping timeout: 256 seconds]
genpaku has quit [Remote host closed the connection]
genpaku has joined #picolisp
beneroth has quit [Remote host closed the connection]
beneroth has joined #picolisp
jmarciano has joined #picolisp
<jmarciano> There is question why PicoLisp finds useful following:
<jmarciano> > So go and ask why he thinks (apply '+ ()) -> NIL is more useful than 0
<jmarciano> > given that the sum of the empty set of numbers _is_ 0.
<abu[m]> I would say (+) is meaningless, it is a short form of (+ NIL), i.e.'+' *expects* at least one argument.
<abu[m]> If you want the concept of a sum, you should use the 'sum' function
<beneroth> NIL and zero is not the same.
<abu[m]> yeah
<beneroth> NIL is a bit like NULL in SQL, it indicates a lack of knowledge. Boolean false. Empty list. Class without definition.
<abu[m]> In math, an isolated '+' operator makes no sense
<abu[m]> So also in pil (+) is meaningless
<abu[m]> but (+ NIL) has a meaning
<abu[m]> (apply + NIL) is thus NIL
<beneroth> jmarciano, to answer your initial question: I found it handy and comfortable to have picolisp handling empty list/invalid/unknown value/falsey all as NIL. There might be cases where you want to differentiate between NIL/FALSE/TRUE, which in picolisp you have then to do explicitly, but in my experience in the majority of coding situations you want invalid/empty/non-existent to handle the same way
<abu[m]> I wonder why this issue of (+) creates so much interest among the emacs folks
<beneroth> it's a bit like NULL-pointer being false in C/C++
<beneroth> well NaN (not a number) is also NIL in picolisp
<abu[m]> yep
<abu[m]> so it nicely propagates
<beneroth> jmarciano, also in picolisp the sum of empty list is zero:
<beneroth> : (sum 'prog NIL)
<beneroth> -> 0
<beneroth> (prog here being used as a function which returns the argument unchanged)
<beneroth> same as with the length of an empty list
<beneroth> : (length NIL)
<beneroth> -> 0
<beneroth> -> 0
<beneroth> : (length '())
<beneroth> NIL and '() is the same
jmarciano has quit [Ping timeout: 256 seconds]
* beneroth sighs... they always timeout during the interesting replies
<abu[m]> ☺
<beneroth> \_(ツ)_/¯
<beneroth> sum and addition is not the same thing :D
<abu[m]> Yes
<abu[m]> hmm, seems gone
jmarciano has joined #picolisp
jmarciano has quit [Ping timeout: 268 seconds]
jmarciano has joined #picolisp
hrberg has quit [Ping timeout: 260 seconds]
<jmarciano> I did not find other people interested in that.
<jmarciano> I just wish to understand if (*) is useful, or it was added "just because"
<jmarciano> but I do not see it as "useful" when person wish to explain mathematical theories that are not relevant in Lisp function
<abu[m]> yes, that's the question
<jmarciano> beneroth: yes, I find that behavior useful in programming
<abu[m]> For me the practical usefulness counts, so (*) is a no-care
<jmarciano> That is how I look at languags
<jmarciano> which is recommended or better by experience method to use pil with Emacs?
<jmarciano> Maybe just to set variable `inferior-lisp-program' to "pil" ?
<beneroth> yeah if you want to build math ontologies, better use Haskell I guess. Picolisp is even more than usual lisps optimized for practical application in the area of database and business applications
<jmarciano> I don't need math ontologies, rather human oriented applications such as elementary objects that may serve for anything.
<jmarciano> Elementary Objects:
<beneroth> jmarciano, I write my picolisp code in Emacs, but I have hardly a strong integration. I use and love paredit-mode, but the repl I use in a separate terminal window outside of emacs (I use a tiling window manager, therefore it's not really a benefit/need to use the emac builtin functionalities for me)
<jmarciano> So you write functions in Emacs but do you evaluate one by one or everything at once in REPL?
<beneroth> Elementary Objects can certainly be implemented/represented by picolisp objects
<jmarciano> Or you evaluate and see REPL in other window?
<beneroth> other window. I might do short tests or test of a new function in the repl in separate window. otherwise I write code into files with a start script which (load)'s them to give a running (web) application
<beneroth> I just use Emacs as a text editor, mainly for the paredit functionality (Emacs module which makes it very quick and easy to work with lisp parenthesis)
<beneroth> abu[m] uses the VIP text editor which is a version of vi/vim implemented (by him) in picolisp optimized for picolisp development
<jmarciano> I keep types and subtypes of elementary objects, combinations are then unlimited. Example could be "Note", "Call", which represents note about the finished call, but it could pbe "Call" as type, "Note" as subtype which represent action, to call somebody. It can be "Video" as "Instruction" or "Video" "Report"
<beneroth> other people might use whatever text editor they like most
<jmarciano> aha
<jmarciano> is it gui? Console?
<abu[m]> There is "picolisp-mode" for emacs, but I have no idea about it
<jmarciano> I have symlinked vip to ~/bin and there is problem
<beneroth> vip is console
<jmarciano> realpath $(which vip)
<jmarciano> then: /home/data1/protected/Programming/Software/Lisp/pil21/bin/vip
<jmarciano> $ vip
<jmarciano> bash: /home/data1/protected/bin/vip: /usr/bin/picolisp: bad interpreter: No such file or directory
<jmarciano> so as symlink I canot start it
<jmarciano> which I expected it would work
<beneroth> abu[m], there are like 2-3 picolisp-mode for emacs... no idea. I use the one which was originally distributed together with picolisp. there is one in the emacs package manager. and others can be find on github I think.
<abu[m]> This vip file assumes a global install, in /usr/bin etc.
<abu[m]> beneroth: I see
<beneroth> jmarciano, it is missing /usr/bin/picolisp
<abu[m]> jmarciano: You need to change the hashbang line then
<beneroth> install picolisp (e.g. apt install picolisp) or follow the INSTALL file instruction to get a global installations (basically creating the symlinks)
<abu[m]> or plant symlinks (recommended) in /usr/xxx
<beneroth> or change the vip hashbang line, correct
<beneroth> give it the path to the picolisp binary
<jmarciano> I would like to install it in ~/.local/
<abu[m]> I have the same problem on Android (Termux)
<jmarciano> or /package/prog/pil
<jmarciano> how do I do that? My distribution does not have PicoLisp
<abu[m]> ok, but still the symlinks under /usr are very helpful
<beneroth> abu[m], switching from pil64 to pil21 I've found a coding mistake in some namespaced code.. invalid namespace symbol (prefix), funningly pil64 did not detect it, pil21 did detect it during (load) :)
<abu[m]> PicoLisp is mainly in Debian-derived distros
<beneroth> the mistake was in code of me.. well of my employee. not distro code.
<abu[m]> You mean the namespace was misspelled or so?
<abu[m]> Pil21 can check at runtime, because namespaces have a special marker
<abu[m]> the '~' symbol
<jmarciano> does it require `clang' or `gcc' works?
<jmarciano> i see clang: command not found
<abu[m]> yes, it needs LLVM >= 7
<abu[m]> There is a list of required packages in INSTALL
<abu[m]> libreadline-dev libffi-dev etc.
<jmarciano> okay
<abu[m]> Which Linux distro do you use?
<jmarciano> That is great idea to make specialized editor for PicoLisp
<jmarciano> Does it indent automatically? Open up documentation on symbol?
<abu[m]> It does not automatically indent, only explicitly when typing a comma
<abu[m]> If you type K on a symbol, it opens its source, but not the documentation
<jmarciano> ok
<jmarciano> so it can jump from source of function to function?
<abu[m]> Just keep typing K
<abu[m]> or Q to get back
<abu[m]> or use :tag <symbol> like in normal Vi
<jmarciano> Need time to install
<beneroth> abu[m], yep, misspelled namespace prefix with the ~ notation
<beneroth> it's nice that pil21 detects that :)
<abu[m]> It is too easy to make mistakes here
jmarciano has quit [Ping timeout: 260 seconds]
rob_w has quit [Quit: Leaving]
seninha has quit [Ping timeout: 260 seconds]
seninha has joined #picolisp
seninha has quit [Remote host closed the connection]
seninha has joined #picolisp