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
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #picolisp
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #picolisp
theruran has joined #picolisp
_whitelogger_ has quit [Remote host closed the connection]
f[x] has quit [Remote host closed the connection]
_whitelogger_ has joined #picolisp
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #picolisp
lagash has quit [Ping timeout: 260 seconds]
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #picolisp
lagash has joined #picolisp
lagash has quit [Ping timeout: 272 seconds]
geri has joined #picolisp
<geri> hey-hey
<geri> what's an official source for minipicolisp?
<geri> also, i wonder if it being 32 bit and no bignums means symbol names are limited to 32 bits πŸ€”
<abu[7]> Should be miniPicoLisp.tgz on software-lab.de
<geri> last change in 2020?
<abu[7]> No, names are unlimmited
<abu[7]> earlier IIRC
<geri> do you represent them differently than in standard pil?
<abu[7]> See doc/structures
<geri> sec, need to download the tarball
<abu[7]> It uses "ASCII-6/7" :D
<abu[7]> No unicode
<geri> yeah, i remember that one
<geri> this page is 2020 i mean
<abu[7]> ok
<geri> wow, the directory structure is so clean and nice
<geri> ascii-6/7 is even smaller than normal ascii?
<abu[7]> Yes
<abu[7]> uses 6 or 7 bits per char
<geri> fun
<abu[7]> yeah :)
<geri> what's bin/txt?
<geri> just raw bits for the symbol name?
<abu[7]> T
<abu[7]> I don't remember the details though
<geri> doesnt sound much different from bignums, but removing it from other places must make things nicer id guess
<geri> like namespaces
<geri> actually, if symbols can have big names, namespaces are still a pair of trees, no?
<abu[7]> Mini has no namespaces
<abu[7]> except transients
<geri> ah
<geri> source code looks really cute
<abu[7]> It is a reduced Pil32
<geri> yeah
<geri> i remember seeing how apply was written in C version and it looked extremely painful
<abu[7]> true
<abu[7]> apply is a bit heavy in pil in general
<abu[7]> all versions
<geri> why's that?
<abu[7]> ns
<geri> eh
lagash has joined #picolisp
<abu[7]> The interpreter
<abu[7]> how it works
<geri> i have a problem in my interpreter that idk how to make apply work properly with fexps
<abu[7]> apply wants to pass *evaluated* args
<geri> yaah
<abu[7]> Does'nt work
<geri> and you get (quote . 1 2 3) evaluated twice and that breaks
<abu[7]> You cant apply fexps
<abu[7]> *evaluated*
<geri> harsh
<geri> no wonder i couldnt get my apply working properly
<abu[7]> :)
<abu[7]> Pil basically q
<abu[7]> uotes
<abu[7]> all args
<abu[7]> in apply
<geri> that's what i was thinking to do as well!
<abu[7]> So the args can be passed do FSUBRS
<geri> and let function decide what to do
<abu[7]> Yeah
<geri> ive kind of just realized 99% of the time, i use macros/fexps as just syntactical sugar
<geri> abu[7]: is the apply quoting still a thing in pil21
<abu[7]> yes
<abu[7]> it does it in stach structures
<abu[7]> also shown in doc/structures
<abu[7]> s/stach/stack
<geri> something something bindFrames?
<abu[7]> Line 161
<abu[7]> Quite nested
<abu[7]> It simulatet symbols on the stack
<abu[7]> obscure
<geri> yeah, very
<abu[7]> eg. "val1 <---+" is a "symbol"
<abu[7]> "car ----+ <-- E" is the whole expression
<geri> yeah that's very confusing :D
<abu[7]> So "fun" sees a list of anonymous symbols
<abu[7]> You see that if you stop in a breakpoint in an applied function
<abu[7]> or 'trace' it
<abu[7]> Hmm, no
<abu[7]> trace shows the evaluated args
<abu[7]> Best is an error
<abu[7]> : (de f (A) (foo))
<abu[7]> -> f
<abu[7]> : (apply f (1))
<abu[7]> !? (foo)
<abu[7]> foo -- Undefined
<abu[7]> ? (bt)
<abu[7]> (f $177774472344673)
<abu[7]> A 1
<abu[7]> -> NIL
<abu[7]> $177774472344673 is a "symbol" on the stack
<geri> still a tad confusing ~w~
<geri> so cause of fexps, apply has to quote all its arguments after evaluating
<geri> like, (apply f (quote 1 2 3)) => evaluates quote then quotes everything inside and passed to f
<geri> if f is a builtin i think it wont even need to do any rebinding/storing variables, no?
<abu[7]> right
<abu[7]> but it needs to save evaluated values
<abu[7]> to protect from gc
<abu[7]> 'Push'
<geri> scary gc with an axe looking for unprotected children
<abu[7]> :)
<geri> what about push?
<geri> like eval'd args will get pushed into bind stack or whatever its called?
<abu[7]> T
<abu[7]> it is push()
<abu[7]> not Push
<abu[7]> also save() and safe() iir6
<geri> okay so
<geri> all evaluated arguments are pushed alongside some other data onto a bind stack
<geri> and once you leave the funciton i guess the thing gets popped off
<geri> you said something about anonymous symbols being used there, how does that workf/
<geri> workf/ == work?
<abu[7]> They are just pushed values and links
<abu[7]> so you get a list of symbols
<abu[7]> Try to follow th pointers
<abu[7]> in "car ----+ <-- E"
<abu[7]> This is the first cell
<abu[7]> With "fun <---+" in the CAR
<abu[7]> away for shower
<geri> enjoy
<geri> im processing :D
<geri> im looking at that apply args diagram and my brain doesnt know where stuff starts or ends
<geri> xd
<abu[7]> ret
<abu[7]> :)
<abu[7]> The expression ends at "| /"
<abu[7]> line 180
<abu[7]> and starts at "| car ----+ <-- E |"
<abu[7]> line 169
<geri> hmmmm
<geri> it looked kinda like each stack frame is 5 things...
<abu[7]> The "zero"s are the "names" of the syms
<geri> in memory, is link first or car1 first?
<abu[7]> LINK is pushed first
<abu[7]> -> higher address
<abu[7]> The LINKs are needed to keep gc happy
<abu[7]> All this stuff is "Saved values:"
<geri> anonymous symbols are a cell with car being all 0's & value stored in cdr?
<abu[7]> not all 0
<geri> + tag?
<abu[7]> it is cnt 0
<abu[7]> T
<geri> okay
<geri> wait, so its a number? XD
<abu[7]> yes, a num
<geri> fun
<geri> so, of car1 cdr1 zero val1 and link
<geri> zero + val1 is an anonymous symbol
<geri> link is something to keep gc from nuking the symbols
<abu[7]> all correct
<geri> and what's car1/cdr1?
<abu[7]> the values
<abu[7]> car1/cdr1 are cells
<geri> i thought val1 is the value
<geri> oh wait
<abu[7]> No, I meant the nuking
<abu[7]> the syms are on the stack and safe
<abu[7]> but their values must be gc'd
<geri> hmmmmmmm
<geri> is frame kinda like NIL?
<geri> like a very weird cell :D
<abu[7]> hmm, perhaps
<abu[7]> ewerything is a cell
<abu[7]> except cnt's
<abu[7]> ok, stack frames are not cells
<abu[7]> just here for apply
<geri> well, id argue that NIL is not a cell but an amalgamation :D
<geri> of two cells
<abu[7]> yes
<abu[7]> glued together
<geri> conjoined cells
<abu[7]> For apply this does not matter
<abu[7]> it pushes individual cells
<abu[7]> just happens to be together
<abu[7]> fun/zero plus cdr/car
<abu[7]> pushed in one swoop
<abu[7]> for the interpreter they look like normal cells and syms
<abu[7]> The interpreter just caret about the pointers
<abu[7]> *cares
<geri> ...being tagged properly :D
<abu[7]> Yep
<geri> so for an interpreter this structure is just a linked list?
<abu[7]> so the stack must be aligned
<abu[7]> T
<geri> with car being current value and cdr pointing to next stack frame, hmm
<abu[7]> T
<geri> i just noticed, link seems to point backwards?
<abu[7]> yes, "upwards"
<geri> like, not in direction of cdr
<abu[7]> the stack grows downwards
<abu[7]> cdr may be any direction
<abu[7]> ah
<abu[7]> here, yes
<geri> isnt everything in pil 16 byte aligned?
<abu[7]> in the heap
<geri> on this stack you dont care?
<abu[7]> yes, and stack too
<geri> hmm
<abu[7]> it is on stack for efficiency only
<geri> why is stack frame 5 items then?
<abu[7]> in the C values apply used the heap
<abu[7]> 5 times 64 bits
<geri> you need 1 more time to be aligned properly, no?
<geri> like nil has 1 extra cdr in it for alignment
<abu[7]> No, the stack is aligned only once
<abu[7]> only NIL
<abu[7]> the Cdr of the second cell is ignored
<abu[7]> except by gc
<geri> second cell == zero + val1/fun?
<abu[7]> no, that's the symbol
<abu[7]> cdr/car/E is the first cell
<abu[7]> cdr points to the second
<abu[7]> "+---- cdr"
<abu[7]> "|"
<abu[7]> second cell is line 175
<geri> ah okay
<abu[7]> (for the records: All line numbers refer to current version of doc/structures)
<abu[7]> 09jul24
<geri> yeah i know :D
<geri> # 09jul24 Software Lab. Alexander Burger
<abu[7]> just for the IRC log
<geri> for the actual record, i see
<abu[7]> when archeologists find this in 5000 years
<geri> :D
<geri> lets hope pil survives that long
<abu[7]> sure ;)
<geri> what do you think of python? abu[7]
<abu[7]> I feel it is quite a mess, but I don't know well
<abu[7]> in any case it has no equivalence of code and data
<geri> you can eval strings but that's a so-so experience
<abu[7]> yeah, like in shells too
<geri> mhm
<geri> like, you can do some magic with that as well, but lisp version is just better
<abu[7]> true
<abu[7]> I like the idea of indentation
<geri> how it looks or meaningful indentation?
<abu[7]> before I came to Lisp, I thought about a lang "tabula"
<abu[7]> in the early 80s
<abu[7]> "tabbed abu language"
<geri> :D
<geri> also meaningful indentation language?
<abu[7]> exactly
<abu[7]> no Python in sight at that time
<geri> honestly its a double edged sword
<abu[7]> I got tired of { } in C
<abu[7]> redundant
<geri> yes, code looks a nicer, but its hard to copy paste code for example
<abu[7]> I see
<abu[7]> right
<geri> for me, sexps are is like better python formatting cause indentation explains to you what's going on (usually done by your editor) but you can put all the code on one line and send it somewhere with no problem
<abu[7]> Yeah
<abu[7]> in the end sexprs are optimal
<geri> i wish sexps were standard instead of json
<abu[7]> also better than json, xml and all
<geri> imagine sending programs over network
<geri> sounds kinda dangerous tbh, but fun
<abu[7]> Pil does that
<abu[7]> at least over pipes
<abu[7]> or in HTML URLs
<geri> yeah, add first class environments and have fun
<geri> i guess https makes intercepting and changing traffic midflight less of a problem
<abu[7]> T
<abu[7]> and things need to be 'allow'ed
<geri> every symbol?
<abu[7]> yes
<geri> nice
<abu[7]> fun or var
<abu[7]> "!foo&arg"
<abu[7]> foo must be allowed
<abu[7]> or globals passed in URLs
<abu[7]> "*Var=-123"
<geri> nice nice
<geri> can't you do runnable snippets like in first class environments page in other langauges just by writing a function that passes all variables as arguments?
<abu[7]> How do you mean that?
<geri> (de plus (A B) (+ A B)) lol
<geri> to me at least first class environments look like just a neat little boilerplate reducer
<geri> i guess no equivalence of code and data in non-lisps so it wont be as powerful
<abu[7]> yeah
<geri> though still, especially in picolisp, it doesnt seem as useful cause functions are lists anyway and you can pass em around all you want
<geri> except reduced boilerplate when defining cause dont need to repeat things
<geri> or maybe im missing something...
<abu[7]> Not sure what's your idea ...
<geri> im just trying to understand what youre getting with env+bind that you don't with plain function calls
<abu[7]> I think it is the same
<abu[7]> just that the env is always global
<abu[7]> in dynamic shallow binding
<abu[7]> I mean, global at the moment of EVAL
<geri> i mean, during a function call symbols used for function args are shadowed in either case
<abu[7]> Yes. In *time*, variables are local
<abu[7]> but at a given moment they are global
<abu[7]> Thus we cannot have threads
<geri> sad but necessary
<abu[7]> I don't think it is sad
<abu[7]> threads have many problems
<abu[7]> they are the new goto ;)
<abu[7]> The difference between threads and processes is that the latter have their private memory
<abu[7]> thread wrec havoc on each other's data
<abu[7]> ta
<abu[7]> oops
<abu[7]> (hit "repeat the last three keys" on Steno)
<geri> well, there are always tradeoffs
<geri> how's performance between processes and threads?
<abu[7]> Same
<geri> really?
<abu[7]> on the OS level they are both processes
<geri> huh
<abu[7]> process table entries
<geri> then why are threads a thing?
<abu[7]> They share memory
<abu[7]> no big advantage
<geri> hmmmmmm
<geri> so i could look into parallel processing with fork in picolisp? :D
<abu[7]> A process copies memory areas if needed
<abu[7]> yes
<abu[7]> Pil IPC
<geri> nice
<abu[7]> 'tell'
<geri> honestly most programs i write are really not parallelizable
<geri> just tiny little scripts
<abu[7]> At least you could call 'later' in them
<geri> hm
<geri> parallel number calculation
<abu[7]> silly example :)
<geri> pretty funny that even though pil cant do threading it can do parallel computing and concurrency
<geri> apparently in simple ways than threads anyway
<abu[7]> T, at least with less locking and synchronizing
<geri> very fun
<abu[7]> In pil fork is good because the processes are small
<abu[7]> If you have a huge image, copy on demand gets expensive
<geri> yeah, pil is smol and sweet
<abu[7]> for SBCT or Java threads may be better
<geri> aha
<abu[7]> in terms of efficiency
<abu[7]> not sure
<geri> then probably for emacs as well
<abu[7]> right
<geri> its single threaded and apparently thats a problem when you got something block the whole program
<geri> but there's concurrency support so i think that's just badly written elisp packages
<abu[7]> yes
<geri> do you use ` often in code?
<abu[7]> Backquote? Yes, fairly
<abu[7]> and ~
<geri> its so neat honestly
<geri> ` + fexpr == cl-style macro, in a good way
<abu[7]> I have ~(as (cond) .. often in projects
<geri> how's as different from when?
<geri> well, i guess its when + prog
<geri> or list
<abu[7]> Version dependent code snippets
<abu[7]> different customers for example
<geri> oh wait i think its when + quote
<abu[7]> ~(as (customer1) (gui '(+TextField) ...
<abu[7]> Yes
<abu[7]> But when exists at runtime
<abu[7]> ~(as ) expands at read time
<geri> ~(when (Cond) (quote X Y Z)) i mean
<abu[7]> yes, just more verbose
<abu[7]> I think you need ~(when (Cond) '((X Y Z)))
<abu[7]> a prg
<geri> (de as2 (Cond . Body) (when Cond Body))
<geri> xd
<abu[7]> T
<geri> well, if the core was in C i'd 100% go with "do what is easy in the language in the language"
<geri> but pil is written in llvm already so its still in the language
<geri> what is maintaining pil like?
<abu[7]> fun :)
<geri> good start :D
<abu[7]> ☺
<geri> ever get thoughts that youve done all you wanted in it?
<geri> or just getting new ones constantly :D
<abu[7]> Not all yet
<abu[7]> I want to do more with DES
<abu[7]> and PilBox
<geri> what's des?
<geri> or maybe
<geri> nan des ka
<geri> )
<abu[7]> ☺
<abu[7]> @doc/des.html
<abu[7]> Mia wrote also some blog posts about DES
<geri> looks kinda scary :D
<geri> i think i got the idea though
<abu[7]> It is also a kind of concurrency
<abu[7]> You should try the railway example
<abu[7]> looks really cool I think :)
<beneroth> good morning abu[7] and geri :)
<beneroth> abu[7], yeah the train example is really nice :)
<abu[7]> Cheers beneroth!
<geri> oh hey train example is cute
<geri> herro beneroth
<geri> ill go implement some picolisp builtins in picolisp for fun
<geri> :D
<geri> (de quote2 Any Any)
<abu[7]> good
<geri> oh hey, just found out about all*
<geri> maybe ill get to write proper completion for emacs πŸŽ‰
<geri> or maybe i should write a proper lsp server for picolisp, hmmmmm
<geri> if i get lsp working then anyone could join with any editor and be able to do completions and stuff
<geri> so i guess ill have fun with json
<abu[7]> πŸ‘
<abu[7]> Vip also uses 'all*' for completion
<abu[7]> And a different kind of completion is in https://software-lab.de/irc.tgz
<abu[7]> (not with all*)
_whitelogger_ has quit [Remote host closed the connection]
<geri> nice, nice
<geri> ill save it as a little reference
_whitelogger_ has joined #picolisp
<abu[7]> ok
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
f[x] has joined #picolisp
abu[7] has left #picolisp [#picolisp]
abu[7] has joined #picolisp
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #picolisp
f[x] has quit [Remote host closed the connection]
_whitelogger_ has quit [Remote host closed the connection]
<geri> hey, i just noticed that (packJson '(("id" . 5))) returns "{\"\"id\"\": 5}"
<geri> is double quoting intentional?
<geri> or should there be a case for transient symbols in pack
<abu[7]> Hmm. Not sure atm.
<abu[7]> In fact it is not transient symbols here, as it is one long string
<geri> oh no i think i know
<abu[7]> In *reading* Json transients make sense
<geri> (sym 123) => "123"
<abu[7]> for efficiency
<geri> (sym "123") => "\"123\""
<geri> problem is, that packed json is invalid
<geri> well, maybe it is valid but its absolutely not the intention?
<geri> thats why im asking if it is or nah
<abu[7]> Strings as keys are invalid?
<geri> "id" should be just "id", quotes shouldnt be part of the name
<geri> "\"id\"" but should include quotes
<geri> move but to first position
<abu[7]> It is not a name here
<abu[7]> a single strinig
<geri> its a string that includes quotes in it
<geri> and it shouldnt logically
<geri> (packJson '((id . 5))) -> "{\"id\": 5}"
<geri> this is proper
<abu[7]> So the double quotes are correct
<geri> count the quotes
<abu[7]> ie how parseJson is 'prinl'ed
<geri> "{\"\"id\"\": 5}" vs "{\"id\": 5}"
<geri> second one is valid
<abu[7]> ok
<geri> to me looks like the issue is just (sym) with a transient symbol doesnt just return the symbol but quotes it one more time
<geri> well, maybe thats intentional
<geri> and that's my question :D
<abu[7]> I don't remember
<geri> okay
<abu[7]> (link "\"") could be removed then
<geri> aha i know
<abu[7]> I did not look at it for years
<geri> if you use name instead of sym itll work properly i think
<geri> let me try
<abu[7]> yes
<abu[7]> is (car X) always a symbol?
<geri> where
<abu[7]> in parseJson
<geri> uh
<abu[7]> If it can be a nuw
<abu[7]> (name) would fail
<geri> eh
<abu[7]> *num
<geri> it can be anything i guess
<geri> sad
<abu[7]> otherwise your suggestion of 'name' is better
<geri> ill just use quoted non-transient symbols for now
<geri> ill look into it a tad later
<abu[7]> 'sym' is also bad because if these syms happen to be interned they are packed differently
<abu[7]> Can you (and perhapt somebody else here) think a little about that? Then we'll change the two cases of 'sym' to 'name'
<geri> yeah ive noted it down
<geri> trying to see how recur works now
<abu[7]> Great
<abu[7]> Thanks!
<abu[7]> I also noted it
<geri> we contributin
<abu[7]> πŸ‘
<geri> wow okay so something silly
<geri> if you use name then "5" gets packed as a number
<geri> pretty cursed
<abu[7]> T
<abu[7]> "5" is probably never used as a key, gives problems in other systems too
<geri> what are you using
<geri> other systems
<abu[7]> I don't
<geri> "gives problems in other systems" - what systems?
<abu[7]> I mean the originator of the Json
<geri> hm
<abu[7]> source
<geri> fun
<abu[7]> readJson probably has the same problem with numeric keys
<geri> eh
<abu[7]> uses 'read' iirc
<geri> it does
<abu[7]> I don't know the formal spec of identifiers in Json
<abu[7]> I would expect a number to be illegal
<geri> i only know that it'4 pretty insane all things considered
<geri> yeah, key can only be a string
<geri> but "5" is a valid string
<geri> object
<geri> i think you cant pack empty strings and null either
<geri> fun
<abu[7]> T
<abu[7]> needs checks
<geri> gonna get slower..
<abu[7]> also for things like "5"
<abu[7]> speed is no issue I think
<geri> okay good
<abu[7]> Wait, but changing sym to name should do
<geri> in object case yes
<abu[7]> The double quotes are still linked
<geri> still need cases for some of the literals
<geri> false null true
<abu[7]> Not sure if needed here
<geri> wait i copied wrong version i think lol
<geri> nvm i copied both
<geri> second one
<geri> if i wanna get an expression {"hi": null} i need to mangle outputs manually
<geri> so id argue yes
<geri> there's a limited amount of literals thankfully
<abu[7]> In @lib/android.l and @src/lib/llvm.l there is 'null' too
<geri> hm
<geri> doesnt seem to be a json thing tho
<geri> difficulttt
<abu[7]> JavaScript
<geri> true
<geri> xd
<abu[7]> Need to stop for todag
<abu[7]> y
<geri> night night
<abu[7]> let's see ...
<abu[7]> ☺
<abu[7]> Sleep well!
<geri> that was to you!
<geri> but thank you
<abu[7]> :)
<geri> universal nil kinda makes me wander how do you encode empty dict differently from an empty list or false in json xd
<geri> but that's tomorrow
<abu[7]> no idea ;)
<abu[7]> anyway
<abu[7]> γŠδΌ‘γΏ
taleon has quit [Quit: leaving]
taleon has joined #picolisp
aw- has left #picolisp [#picolisp]
aw- has joined #picolisp