<geri>
hey, i think im finally getting the symbol data structure graph :D
<geri>
in NIL, all cells except first one (that has its name) are pointers to NIL itself?
<geri>
symbols pointing directly to their values is neat too cause no need to shift to get the value, just a simple pointer lookup
<geri>
oh wait, i think nil might have clicked
<geri>
as a symbol, it points to itself and with 8 bit offset you can get its name
<geri>
cons cells get pointed to their car, so it reads second and 3rd segment of the NIL structure
<geri>
and fourth is there just to not mess with alignment?
<geri>
ie not used otherwise
<abu[7]>
Hi geri!
<abu[7]>
All correct 👍
<abu[7]>
"8 bit offset" should be "8 bytes"
<geri>
honestly all of these are so smart
<geri>
its amazing
<geri>
also symbol names just being bignums/numbers interpreted slightly differently
<geri>
it's all coming together nicely
<abu[7]>
☺
neuroevolutus has joined #picolisp
rob_w has joined #picolisp
<geri>
if i have a 2^60 number (that should be stored in the pointer), what happens when i add 1 to it?
<abu[7]>
It will overflow to a bignum
<geri>
well yeah, im more wondering how this overflow to a bignum works
<abu[7]>
Just creates a new bignum
<abu[7]>
Bignum arithmetics create new nums
<abu[7]>
ie. consing
<geri>
so i got 1111111111111111111111111111111111111111111111111111111111111010 + pointer to nil, right?
<geri>
before adding 1
<abu[7]>
almost
<geri>
does original data get scrapped completely in favour of using a "digit" representation?
<abu[7]>
...0010
<geri>
ah, 1 is minus? okay
<abu[7]>
T
<abu[7]>
The original always remains
<abu[7]>
just a pointer here
<abu[7]>
but may still be hold somewhere
<abu[7]>
thus arithmetics need to be non-destructive internally
<geri>
hmm
<geri>
so it's 1111111111111111111111111111111111111111111111111111111111110010 + pointer to shortnum 1?
<geri>
digit represenation is still a bit confusing
<abu[7]>
No, the tag bits are not needed
<abu[7]>
Can use the full 64 bits
<abu[7]>
DIG
<geri>
hmmmmmm
<abu[7]>
the CDR is short zero iirc
<geri>
oh wait
<geri>
so it's 1111111111111111111111111111111111111111111111111111111111111010 + pointer to 0011111111111111111111111111111111111111111111111111111111111111?
<abu[7]>
no, it is 2**60 in the CAR and ZERO in the CDR
<geri>
but how do you know that the object is a bignum if you use all bits?
<geri>
oh wait nvm
<abu[7]>
The pointer encodes it
<geri>
tags are in place, you just shifted the number
<abu[7]>
No
<abu[7]>
the data have no tags
<abu[7]>
only the pointers *to* the data
<abu[7]>
data means cells
<geri>
it's not 1111111111111111111111111111111111111111111111111111111111111010 + 0?
<abu[7]>
no
<geri>
same as 111 + 1 = 1000, but first bits stay in place
<geri>
and you grow into the cell in heap instead of growing "to the left"
<abu[7]>
exactly
<abu[7]>
In all cases
<abu[7]>
also if adding 2 bimnums etc.
<abu[7]>
big*
<abu[7]>
So we just use the available space
<abu[7]>
60 bits in a short, or 64 in a big
<abu[7]>
(in a big *cell*)
<geri>
how are arithmetic operations implemented on bignums?
<abu[7]>
like on paper
<abu[7]>
just bigger digits
<geri>
dont you need to start from end on paper?
<abu[7]>
yes
<abu[7]>
so the lowest digit is the first
<abu[7]>
only comparisons need to start from the highest digit
taleon has quit [Remote host closed the connection]
<geri>
okay wait, need to rethink bignums' structure again xd
<abu[7]>
no hurry
<geri>
do shortnums grow left to right or right to left?
<geri>
111 + 1 => 1000 or 0001
<abu[7]>
1000
<abu[7]>
just hardware
<abu[7]>
bit representation
<geri>
okay...
taleon has joined #picolisp
<geri>
then 60**2 + 1 should be 0000000000000000000000000000000000000000000000000000000000000100 + pointer to short 1?
<abu[7]>
no, 10....00 + pointer to short zero
<abu[7]>
(vi 'llvm~ZERO)
<abu[7]>
ie. 000..010
<geri>
but you said it bignums go "in reverse"...
<abu[7]>
on the cell level
<geri>
oh
<geri>
hm
<geri>
but bits go as usual?
neuroevolutus has quit [Quit: Client closed]
<abu[7]>
little or big endian
<abu[7]>
hardware
<geri>
okay..
<geri>
so if i grow a number 2**(66+64) + 2, then itll be 10...100 followed by pointer to short 1, followed by a pointer to zero short?