<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?