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]>
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>
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.