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
chexum_ has quit [Ping timeout: 240 seconds]
chexum has joined #picolisp
isaneran has joined #picolisp
pablo_escoberg has joined #picolisp
rob_w has joined #picolisp
rob_w has quit [Remote host closed the connection]
pablo_escoberg has quit [Quit: Client closed]
seninha has joined #picolisp
isaneran has quit [Ping timeout: 245 seconds]
seninha has quit [Ping timeout: 245 seconds]
seninha has joined #picolisp
dexen has joined #picolisp
<dexen> helo, how do i (inc ...) a value in a list? the idea is to avoid first extracting the current value value, modifying it, and then setting it, but rather to operate on it directly.
<dexen> (setq Foo 1) (inc 'Foo) (pp 'Foo)
<dexen> (setq Bar (1 1 1 1)) (inc '(get Bar 2)) (pp 'Bar)
<abu[7]> Hi dexen
<abu[7]> To increment the second element (inc (cdr Lst))
<abu[7]> : (setq L (range 1 9))
<abu[7]> -> (1 2 3 4 5 6 7 8 9)
<abu[7]> : (inc (nth L 5))
<abu[7]> -> 6
<dexen> excellent. is there a generalized (cdr ...) that'd be equivalent of (get Lst 1 1) ?
<abu[7]> : L
<abu[7]> -> (1 2 3 4 6 6 7 8 9)
<abu[7]> yes, 'nth' :)
<dexen> thanks that does it. *now* i can find it in Rosetta Code's "Array" article
<abu[7]> Great :)
<abu[7]> Often it is better to use properties than a list
<dexen> because explicitly named vs numbered position? or some further reasons?
<abu[7]> you can do (inc (prop 'Sym 'foo)) or (with 'Sym (inc (:: foo)))
<abu[7]> It is also more efficient as not a possibly long list is traversed
<abu[7]> Not critical unless the list is really long though
<bjorkintosh> this is a parallel universe lisp isn't it? the 'p' is for parallel.
<abu[7]> With "this" you mean PicoLisp?
<bjorkintosh> T
<abu[7]> Interesting point
<abu[7]> "universe" is too big
<bjorkintosh> abu[7], I almost never see references to picolisp anywhere lisp is discussed.
<bjorkintosh> I find it refreshing, actually.
<bjorkintosh> I like the feature set.
<abu[7]> Good to hear :)
<bjorkintosh> a db, embedded prolog, gui, and a few others.
<abu[7]> Currently I find coroutines the most interesting feature. Still exploring.
<bjorkintosh> is it part of picolisp at the moment?
<abu[7]> Yes
<bjorkintosh> what's the whole thing written in, C?
<abu[7]> The 32~bit version was in C. The current one is written in PicoLisp directly, and compiles to LLVM
<abu[7]> llvm-ir to be precise
<bjorkintosh> remarkable.
<abu[7]> Do yoo have a running installation?
<bjorkintosh> one one of my machines, I do.
<bjorkintosh> yepp.
<bjorkintosh> :
<abu[7]> You can explore the sources, e.g. (vi 'car)
<bjorkintosh> vi?
<bjorkintosh> (polite cough)
<bjorkintosh> okay.
<abu[7]> It is "Vip"
<bjorkintosh> undefined.
<dexen> the feature set also includes an OS (OS research is still relevant)
<abu[7]> : (vi 'vip)
<bjorkintosh> weird. doesn't work at all. does it have to be separately installed?
<abu[7]> hmm
<abu[7]> You need to start in debug mode
<abu[7]> $ pil +
<abu[7]> $ man pil
<bjorkintosh> aha!
<abu[7]> Probably you tried only 'picolisp' which is just the plain binary
<bjorkintosh> exactly what I did.
<bjorkintosh> now it works.
<abu[7]> :)
<abu[7]> I think you would prefer emacs
<bjorkintosh> You are correct.
<abu[7]> I do not know emacs well, but some people here use it
<abu[7]> Vip is better integrated though
<bjorkintosh> I started out with ed, and then ex, and then vi, and then vim. so I still know how to :q
<abu[7]> Perfect!
<abu[7]> Vip is a bit different from Vim
<abu[7]> more permissive
<abu[7]> But basic navigation is the same
<abu[7]> and a *lot* smaller than Vim of course
<bjorkintosh> tell me, which lisp is picolisp closest to?
<abu[7]> The Lisps which originally influencet it were Maclisp, Interlisp, and most of all Portable Standard Lisp
<abu[7]> But that's long ago, not much left of them in Pil
<abu[7]> I think Pil is not close to any lisp because of one fundamental design decision: No compiler
<bjorkintosh> oh I see. well Interlisp is being actively revived.
<abu[7]> yes, heard about it
<abu[7]> If you target an interpreter instead of a compiler, you get a totally different language
<abu[7]> It is hard to see initially
<bjorkintosh> how's that?
<abu[7]> It is a different view on the virtual machine
<bjorkintosh> oh I see.
<abu[7]> Macros become useless, and FEXPRs are useful
<bjorkintosh> ah so no macros in picolisp?
<bjorkintosh> I just looked at the standard lisp manual. it's only 42 pages!!
<abu[7]> There is a 'macro' function, but used only for special cases
<tankf33der> Never used.
<abu[7]> I used in GUI sometimes
<abu[7]> useful to call non-evaluating functions dynamically
<abu[7]> What you do with macros in compiled Lisps you do directly with functions in PicoLisp
<abu[7]> the 'do*' example is a bit meaningless
<bjorkintosh> so the standard pico lisp reference is just whatever is on the website right?
<bjorkintosh> there's no external reference beyond that.
<abu[7]> The standard ref is https://software-lab.de/doc/index.html
<abu[7]> It is also in the distro
<abu[7]> picolisp.com is other stuff, examples etc n
<abu[7]> or the blog at https://picolisp-blog.hashnode.dev
<abu[7]> The reference is as I said in the distro
<abu[7]> You can do
<abu[7]> $ pil +
<abu[7]> : (doc 'car)
<abu[7]> Whis expects w3m to be installed
<abu[7]> Else : (doc 'car "firefox") or so
<bjorkintosh> fascination. what prompted the inclusion of prolog?
<abu[7]> It integrates nicely with Lisp syntax, and provides some powerful extension
<abu[7]> And is very simple as an add-on
<abu[7]> The code in the pil core system is just three function
<abu[7]> 'prove', 'unify' and '->' iirc
<bjorkintosh> (vi 'core)?
<abu[7]> There is no 'core' per se
<abu[7]> : (vi 'llvm~main)
<abu[7]> (~ is a tilde, not a dash)
<abu[7]> In the code you can then click on other symbols
<abu[7]> With Shift-K (cr ^] like in Vim)
<abu[7]> To see the Pilog built-in code, do (vi 'prove) etc
<bjorkintosh> oh there's some assembly in the sources? picolisp.s
<bjorkintosh> looks like it's generated.
<abu[7]> This is generated by LLVM in the make process
<abu[7]> yes
<bjorkintosh> very cool.
<abu[7]> (vi 'llvm~main) is in src/main.l
<abu[7]> all .l files in src/ compile to *.ll files
<abu[7]> llvm
<abu[7]> src/base.ll is the core system
<abu[7]> Or let's call it "base" system
<abu[7]> There is a single C file for system dependent stuff
<abu[7]> src/lib.c
<bjorkintosh> I'm going to dig into it. I like it.
<bjorkintosh> hopefully I learn something from the design of the system.
<abu[7]> Good, ask here any time
<bjorkintosh> gui question. is it web only?
<abu[7]> Yes, in the distro is only the web gui
<abu[7]> There is also PilBox for Android, but its GUI is based also on the same web gui
<bjorkintosh> is that the httpGate part?
<abu[7]> httpGate is a kind of proxy
<abu[7]> The GUI is independent of it, but for a useable application server it is useful
<tankf33der> http://pb1n.de
<abu[7]> tankf33der, did you change something?
<tankf33der> No, why?
<abu[7]> I was not sure about the pb1n syntax
<tankf33der> :)
<abu[7]> allright :)
<bjorkintosh> abu[7], does pico talk to other databases like postgres or sqlite?
<abu[7]> Not sure, I think ther was a discussion about sqlite here
<abu[7]> I used only CSV to import data
<bjorkintosh> ah okay. so csv is the bridge (of sorts)
<abu[7]> the easiest
<abu[7]> I think aw- and pablo_escoberg can say more
<abu[7]> It is not difficult to use native calls to DB-interfacing libraries
<abu[7]> yep
<abu[7]> But bothe examples are not foreign DBs
<tankf33der> This is how easy live without them
<abu[7]> With some effort sqlite etc. could be integrated read-only as '*Ext' objects
<abu[7]> Yes, that's true
pablo_escoberg has joined #picolisp
<abu[7]> I needed only to *import* data from other DBs, so CSV was enouinfn
<abu[7]> *enough
<abu[7]> :)
<dexen> a half-way solution for SQLite would be communicating with the CLI tool over pipe. performance ought to be sufficient; real work to implement would be in marshalling *parameters* from picolisp datatypes, and in parsing results.
<abu[7]> Hi pablo_escoberg! You experimented with sqlite interfaces, right?
<pablo_escoberg> There is a full sqlite driver at https://github.com/evronm/picolisp-sql/
<pablo_escoberg> It works AFAIK, but I've pretty much abandoned it in favor of pildb
<abu[7]> dexen, right
<abu[7]> ok
<pablo_escoberg> dexen that's one of the approaches I took, but there is also a full driver with native library support
<pablo_escoberg> That said, I strongly suggest new users play with pildb.  It's really a lot easier to work with.
<dexen> interesting the source is very short
<pablo_escoberg> yeah, the sqlite libs are excellent.
<dexen> is there a convention regarding SQL's NULL? mapping it to () / NIL, or perhaps something yet else?
<pablo_escoberg> Good question.  I never delved really deeply into it.  Once I started putting classes on top of database tables, I realized I was on a fools errand and abandoned the project.  Never really got around to playing with details like null.  Please feel free to take over the project; If you want, I can transfer the repository to you.
<abu[7]> @src/lib/llvm.l uses a separate 'null' symbol
<dexen> thanks i'm not the right person, being an utter noob at lisp (and i gave it first try >10 years ago)
<abu[7]> no worries :)
<pablo_escoberg> That was me 6 months ago when I started building the thing :).
<pablo_escoberg> Really glad to have you on board dexen.  I love it when new people discover this little world.
<dexen> abu[7] a quick look at @src/lib/llvm.l suggests it's a C-ish memory pointer NULL, and not SQL-ish "missing/unknown data" NULL...?
<abu[7]> right
<abu[7]> In PilBox communicating with the Java engine 'null' maps to NIL
<abu[7]> So I thing NIL is more useful
<abu[7]> *think
<dexen> SQL results typically are records - either vectors or name:value maps. i suppose PL would represent that as lists and symbols with properties respectively...?
<pablo_escoberg> yes, that's how I did it in that driver.
<pablo_escoberg> I was then going to put classes on top of that, but never got around to it.
<pablo_escoberg> But before you get too deep into integrating pil with sqlite, read this carefully:  https://picolisp.com/wiki/?pilvsorm
pablo_escoberg has quit [Quit: Client closed]
dexen has quit [Quit: Konversation terminated!]
pablo_escoberg has joined #picolisp
<bjorkintosh> pablo_escoberg, so what is pildb then?
<bjorkintosh> a picolisp sqlite driver?
<pablo_escoberg> It's the DB built into picolisp
<pablo_escoberg> It's a network/object non-sql database.
<bjorkintosh> oh you're saying not to bother with sqlite.
<bjorkintosh> when using picolisp
<pablo_escoberg> that would be my recommendation, yes.
<bjorkintosh> gotcha.
<pablo_escoberg> The article linked above gives a good overview of the reasoning.
pablo_escoberg has quit [Quit: Client closed]
pablo_escoberg has joined #picolisp
bjorkintosh has quit [Remote host closed the connection]
bjorkintosh has joined #picolisp
bjorkintosh has joined #picolisp
bjorkintosh has quit [Changing host]
pablo_escoberg has quit [Quit: Client closed]
seninha has quit [Ping timeout: 245 seconds]
bjorkintosh has quit [Remote host closed the connection]
bjorkintosh has joined #picolisp
bjorkintosh has joined #picolisp
bjorkintosh has quit [Changing host]
casaca has joined #picolisp
seninha has joined #picolisp