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
f8l has joined #picolisp
geri has joined #picolisp
<geri> o7
<geri> just wrote a new cv in html + css, exported to pdf via browser
<geri> was surprisingly easy
<abu[7]> 👍
<geri> was too lazy to learn latex :D
<geri> how are you adapting to sweep typing?
<abu[7]> Getting better
<abu[7]> Still st
<abu[7]> low though
<geri> 頑張れ!
<abu[7]> はイ
<abu[7]> い
<geri> )
<abu[7]> Hit wrong field in candidates
<abu[7]> too small on top of the screen
<geri> that happens
<geri> im pretty happy about my silly little cv
<geri> )
<abu[7]> You can also write it in @lib/svg.l ;)
<geri> also only now actually realized how first class environments work, its amazing how simple it is
<geri> just an alist of variables
<abu[7]> yes
<abu[7]> cons pairs
<abu[7]> To be exact, these are not really the envs
<abu[7]> Just to manipulate them
<abu[7]> represent them
<geri> yee
<abu[7]> Real env is only one at a time
<abu[7]> (per coroutine)
<abu[7]> I mean one per coroutine
<geri> how is the env represented again?
<geri> in my little lisp its a list of dictionaries
<abu[7]> In the global bindings
<geri> hmm
<abu[7]> So in pil per namespace and coroutine
<abu[7]> Global in the namespace
<abu[7]> The syms are bound locally and dynamicaluy
<geri> hmmmm
<abu[7]> ..ally
<geri> i gotta check again how let works
<geri> also ive been asked if its possible to do keyword arguments in pil, i said probably just pass an alist as an argument, but i dunno
<abu[7]> There was a task in Rosetta
<abu[7]> yes, alists is one way
<geri> okay so every symbol also acts as a stack? 🤔
<abu[7]> No
<abu[7]> Just a single value
<geri> saying cause of (push (val Y) Y (val $Bind)) in _Bind
<abu[7]> It is *saved* on the hardware stack
<abu[7]> This push is the hardware stack
<abu[7]> Not the Lisp level push
<abu[7]> See @doc/structures
<abu[7]> "Bind"
<abu[7]> Most basic is "Saved values"
<geri> i can never figure out how to read these diagrams...
<abu[7]> Hmm
<abu[7]> "Bind frame" saves symbols and their old values
<abu[7]> valN and symN
<geri> what's LINK?
<abu[7]> Pointer to the next entry
<abu[7]> Spaghetti stack perhaps
<geri> :D
<geri> so on that diagram on the bottom we have the newest bindings
<geri> and at the top?
<geri> with @'s
<abu[7]> This is for bindings in a function call
<abu[7]> Not 'let' etc.
<abu[7]> Functions automatically save also '@'
<abu[7]> and the Expr
<abu[7]> (for debug, but also access explicitly)
<abu[7]> eg. 'up'
<geri> i hadn't used up yet, surprisingly
<geri> but i get the idea
<abu[7]> Also 'trail'
<abu[7]> and thus 'bt'
<geri> i believe ill some day be able to understand all of those structures!
<geri> some day...
<abu[7]> Sure! It is no magic.
<geri> cnt is a number that fits in 60 bits? (4 tag bits i think...)
<abu[7]> Right
<abu[7]> Plus sign
<abu[7]> Thus 61 bits
<geri> okay
<geri> bignums and normal pairs are easy enough :D
<geri> what's with LIN string as first element in NIL?
<abu[7]> Haha, a funny notation
<abu[7]> means that the first char is at the lowest bits
<abu[7]> The lowest 8 bits
<abu[7]> Same with |'cba'|'fed'|
<geri> so nil is a 64bit value (like everything else), where the first 8 bits encode its "name"?
<abu[7]> ie abc def
<abu[7]> It is both a sym and a pair
<geri> i read about that today yeah
<abu[7]> First it is a sym
<abu[7]> but the cell next to it works as a CDR
<abu[7]> The only two cells hardcoded next to each other
<geri> what's with the + in the middle of the second box?
<geri> bottom edge
<abu[7]> Oh, a typo!
<geri> contributing!
<abu[7]> Thanks!
<abu[7]> Indeed
<abu[7]> Is it also in ref.html?
<abu[7]> copy/paste ;)
<geri> actually not
<geri> only structures
<abu[7]> good
rob_w has joined #picolisp
<abu[7]> fixed
<geri> so nil is just a symbol and a cell "concatenated" together?
<abu[7]> Exactly
<geri> how do things know whether to treat nil as a symbol or as a list?
<geri> s/list/cell/
<abu[7]> Hmm
<abu[7]> It is hardcoded in the interpreter functions
<abu[7]> eg 'cdr'
<abu[7]> vs. 'car'
<abu[7]> 'needVar' vs 'needLst'
<abu[7]> So the CDR of NIL can be accessed
<abu[7]> but not of other symbols
<geri> remind me, is there a jump to definition hotkey in pil
<geri> vip*
<abu[7]> ^] or K
<abu[7]> ^T or Q to go back
<geri> needvar just returns an error when arg's a number, needLst - when its neither pair or nil
<geri> and definition of car itself i kinda dont understand ~w~
<abu[7]> T
<geri> (asm () ((X) ...))
<geri> @lib/llvm.l
<abu[7]> Yes. Generates ASM for the LLVM
<abu[7]> a kind of asm
<geri> whats actually happening in llvm~cdr & car?
<abu[7]> llvm originally meant "low level virtual machine" iirc
<abu[7]> I generates code into the *.ll file
<abu[7]> Just printiny
<abu[7]> g
<geri> i mean, what's the code printed doing?
<geri> :D
<geri> all the ssa stuff
<abu[7]> It is a "single static assignment" machine
<abu[7]> a virtual CPU
<abu[7]> with an infinite number of registers
<abu[7]> each register is assigned only once and never changed
<abu[7]> Cool idea :)
<abu[7]> Or was it "static single assignment"?
<abu[7]> The latter I think
<geri> so *Ssa keeps track of which register you're at
<abu[7]> Yes
<abu[7]> incrementing
<geri> and (ssa ...) puts stuff into that register
<abu[7]> and links to the printed list
<geri> inttoptr hmm
<geri> is that defererencing car?
<abu[7]> integer to pointer
<geri> okay, so 2 lines together deref
<abu[7]> LLVM-IR is extremely verbose
<geri> first one gets the pointer, second one loads it somewhere
rob_w_ has joined #picolisp
<geri> or something like that
<geri> what does pack do in IR?
<geri> or is it literally returning %999 or whatever *Ssa is
<abu[7]> Which pack?
<abu[7]> in 'ssa'?
<geri> line after second ssa
<geri> in llvm~car
<abu[7]> (ssa (inc '*Ssa) "load i64, i64* %" (dec *Ssa)) ?
<geri> pack is next line!
<abu[7]> ah, yes
<abu[7]> it stores it in the var
<abu[7]> "def"
<geri> okay
<geri> im not great at assembly, gotta admit
<abu[7]> The var is a transient sym like "%38"
<geri> yeah, okay
<geri> btw ive been thinking, wouldn't it be simpler to implement only non-evaluating functions (let, but not bind) and use (macro) for forced eval?
<geri> gonna almost half the code you gotta write for builtins, but slightly less performant and convinient
<abu[7]> 'macro' would not suffice
<abu[7]> You need an evaluating function sometimes
<geri> (bind (list (list 'X 10)) X) == (let @Binds (list 'X 20) (macro (let @Binds X)))
<geri> pretty ugly
<abu[7]> And static
<geri> m?
<geri> isnt it the exact same thing as bind form, except argument is formatted slightly differently
<abu[7]> You cannot use it as a first class function
<abu[7]> (mapcar bind ...
<geri> i cant imagine anyone ever mapcar'ing a bind
<geri> shouldn't it still work if you wrap the form in a lambda?
<abu[7]> Yeah, but you lose the power
<geri> or you can do
<geri> it's quite involved though
<abu[7]> Good!
<geri> technically less code, but its all moved to pil side and loses performance because of that...
<abu[7]> I have some GUI functions which do not evaluate, so I'm forced to 'macro' them, as you said, ugly
<geri> very
<geri> also i think on C side it'd be easier to do this way ive posted
<geri> just eval first arg and pass everything to let
<geri> not like it really matters, but it makes sense if thinking about minimizing code repetition
<geri> (except bind and let take arguments differently so it wont work XD)
<abu[7]> Sometimes code repetition is also more clear
<abu[7]> in addition to performance
<geri> *some* times
<abu[7]> In any case built-ins should be as fast as possible
<geri> ye i know
<geri> does pilsrc have macros :)
<abu[7]> It is normal pil
<abu[7]> Unless overridden, everything is available
<abu[7]> And t
<abu[7]> oops
<abu[7]> RET instead of BS
<geri> aight, going for a walk
<geri> laters
<abu[7]> See you! :)
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp
* geri is totally still walking
<abu[7]> Wow
<geri> :D
<geri> nah i worked for the whole day
<abu[7]> ok
<geri> also on my laptop bluetooth has seemingly died so i cant use my fancy keyboard atm :()
<geri> :(*
<abu[7]> brb
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
rob_w has quit [Ping timeout: 256 seconds]
<geri> abu[7]: did the cat attack you again
<geri> )
<abu[7]> No :) I did some experiments
<geri> iyo, what are downsides of dynamic scoping (or binding? idk :D)
<abu[7]> Yes, binding. You may get hygenic problems analog to macros in CL
<geri> hygienic*?
<geri> that the thing you got naming conventions for?
<abu[7]> Yes
<abu[7]> There is a note about t
<abu[7]> hat in the FAQ
<abu[7]> doc/faq.html#problems
<geri> right
<geri> i saw some comments about for example
<geri> (de x () y) (de z (y) (x)) (z 5) => 5
<geri> "oh that's not intuitive and hard to read"
<abu[7]> T, free vars
<geri> imo dont just have free variables sprinkled around without a reason if you find it hard to read
<abu[7]> (lint) will complain
<abu[7]> I recommend (lintAll) from time to time
<geri> i mean, free vars can be good, just dont abuse them
<abu[7]> right
<geri> its not such a hard footgun to avoid anyway
<abu[7]> Another reason is that lexical binding is better to compile
<abu[7]> Gives more efficient code
<abu[7]> Moment, brb
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<geri> the cat won't stop crashing you!
<geri> (very bad joke, but I doubt I'll never stop it :D)
<abu[7]> Nope, it sleeps on the floor
<abu[7]> Experimenting with the irc client
<geri> i know, just being silly
<geri> what's lit for?
<abu[7]> It means "literal"
<abu[7]> for quoting after eval
<geri> after eval?
<geri> got an example?
<abu[7]> There are several in the distro
<abu[7]> once more
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<geri> can't you open a second client and join with a different nickname instead of leaving all the time?
<abu[7]> I did
<geri> hmm
<abu[7]> A separate new channel
<abu[7]> But I wanted to test something
<abu[7]> For now I reverted here to old versipn
<geri> aighty
<geri> did you ever need to drop down to C for performance reasons?
<abu[7]> In pil32 ?
<geri> in any pil
<abu[7]> I think I always anticipated a potential bottleneck
<geri> but never found one? :D
<abu[7]> I don't remember *any* performance problems in code
<beneroth> with pil, performance problems are usually just bad programming
<abu[7]> I DB on pil32 early
<abu[7]> needed B-Trees then
<beneroth> or something which picolisp is not optimal for, then you can always implement it as pil library
<abu[7]> T
<beneroth> abu[7], ht library you did just out of anticipation? or mainly for the buffered ht:Out ?
<abu[7]> anticipation
<beneroth> top
<abu[7]> I thought it is heavily used
<beneroth> geri, you saw the bit about ":" being an optional read macro.. kinda
<beneroth> abu[7], it is
<geri> beneroth: when?
<abu[7]> T, but perhaps even here not critical
<beneroth> geri, when a symbol has : in the name, the reader looks first for the symbol/function in a library (in the run dir). e.g. (ht:pack ...) will fetch 'pack from 'ht' library
<geri> sounds cl-ish!
<abu[7]> It is not a read maco
<beneroth> the library is assumed to be implemented in the picolisp "host language"(?), so in C for the 32bit picolisp C implementation, in asm for the 64bit picolisp AMD-asm implementation, and in compiled LLVM for pil21
<geri> did you implement that as a library?
<beneroth> abu[7], is it upon reading or upon function call?
<abu[7]> it is an error fallback
<beneroth> right!
<beneroth> when the reader does not find it, before creating it, it looks for the lib. <-- correct?
<abu[7]> Not the reader
<abu[7]> the interpreter
<abu[7]> if undefined, it looks for a lib
<abu[7]> foo:bar
<beneroth> geri, check out @lib/ht.so and @lib/ext.so and @src/ht.l @src/ht.ll etc.
<beneroth> abu[7], ok, so during evaluation
<abu[7]> a legal symbol
<abu[7]> yss
<beneroth> I will try to remember, thanks for correcting :)
<abu[7]> :d
<abu[7]> :)
<geri> i dont have ht.l/ll, only .so
<abu[7]> not @src/ext.l ?
<abu[7]> and ht.l
<abu[7]> Must be
<geri> oh, in src
<abu[7]> yeah
<abu[7]> It builds @lib/ext.so
<geri> again with the two letter name for the library file without any explanation header...
* geri craves docstrings
<beneroth> yeah, unfortunately ht and ext are not really documented :(
<geri> what does ht stand for at least
<beneroth> I used to say I will make one eventually, but so far I haven't neither :$
<beneroth> http xD
<abu[7]> @oc/ref.html#libs
<beneroth> help library for low level http functionalities
<abu[7]> Yes, ht is for hypertext
<beneroth> url encoding and url decoding, and most importantly: chunked output
<geri> ah okay
<abu[7]> Right, chunked is indeed time critical
<abu[7]> complicated at least
<abu[7]> and an insane concept
<beneroth> I would say the complicated part is the buffering, buffering up until its a chunk
<beneroth> not so feasible to do on lisp level
<beneroth> abu[7], insane? you mean, because it's kinda unnecessary and bloated, instead of just sending a stream?
<abu[7]> T
<abu[7]> use dynamic buffers on the receiver side
<beneroth> ah, but dynamic buffers are not C-style
<beneroth> much to safe
<beneroth> not enough prone to security critical bugs
<abu[7]> You can do fine in C
<geri> itsd funny that pil breaks tradition on lambdas & quote, backquote and other stuff, but is traditional in being a dynamically scoped interpreted lisp :D
<abu[7]> realloc()
<beneroth> yeah, but not stylish enough. like dynamic sized arrays :P
<beneroth> abu[7], you are right about chunked http stream. It gives additional metadata for the client to decide upon, maybe - but then what options does the client has? either it can handle it or not. so same options when receiving the stream directly without additional metadata.
<geri> didnt get the comment about dynamic arrays
<geri> functions just being lists is real stylish imo
<beneroth> T I think so too
<abu[7]> Tests finished, last time brb ;)
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
<geri> wb
<abu[7]> ☺
rick42 has quit [Server closed connection]
rick42 has joined #picolisp
<geri> is there an example of a picolisp-based REST API anywhere?
<abu[7]> Perhaps pablo_escobert
<abu[7]> I'm not sure about the terminology. I believe the pil web server is REST out of the box, but I never really cared what exactly that means.
<abu[7]> eg. PUT is not supported
<geri> in this case just a server you start and then can curl different endpoints of it as needed
<abu[7]> (redundant as I believe)
<abu[7]> That is possible
<geri> cool
<geri> any very basic examples?
<abu[7]> How about the wiki?
<abu[7]> In any case you can even call any Lisp function on the server
<abu[7]> (if permitted)
<abu[7]> No, that is just a proxy
<geri> cant seem to find anything on the wiki
<geri> i might be blind
<abu[7]> I mean the wiki itself
<abu[7]> The articles as resources
<abu[7]> T
<geri> ill check it out tomorrow
<geri> gonna try to sleep, laters
<abu[7]> 👍
<abu[7]> :)
geri has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.3)]
user3456 has quit [Read error: Connection reset by peer]
user3456 has joined #picolisp
rob_w_ has quit [Read error: Connection reset by peer]
pablo_escoberg has joined #picolisp
<pablo_escoberg> @geri check out Marley at https://github.com/evronm/marley .  It's an autogenerating RESTFUL API for picolisp and PilDB.
<pablo_escoberg> And yes, I'm the author and happy to help.
<beneroth> oh didn't know it, thanks for the pointer :)
<beneroth> I will have a look at it :)
<beneroth> pablo_escoberg, nice idea with extending the +relation classes :)
<pablo_escoberg> Thanks!
chexum has quit [Remote host closed the connection]
chexum has joined #picolisp