> Hi list. I noticed that when I evaluate
>
> (list (box) (box) (box))
>
> I get
>
> ($177760526373112 $177760526373114 $177760526373116)
>
That is common if you just restarted the session or you just needed to
allocate a new block of cells.
> Where each memory location is two more than the previous. I am wondering
> if this behavior is guaranteed to always be the case,
No it is not
> the implication
> being one could have random access to any cell provided he knew the
> address of the first cell.
Yes if your assumption was true it would be that way.
>
> --
> https://qlfiles.net
> --

Why it is not guaranteed?
Both Symbols, Numbers, Lists are built from cells.
Cells are an 128- bit (2* 64) wide something which has flags to tell what
it is.
All unused cells are stored in a free list.
The free list is accidentally in a sorted state when a new block of cells
is allocated (because everey cell is added to the free list in the
beginning that happens by iterating over the block of cells.)
on a garabarage collection all cells which are not reachable by valid paths
are added to the free list again.

That results in three properties.
1 if one element of the is refered to another way it will *NOT* be put back
in to the free list in the right way.
2 The order of the insertion is not defined and all elements are just
inserted at the head maintaining a sorted list makes no sense.
3 blocks of picolisp cells are allocated by the OS at some point in ram so
the blocks are not guaranteed to be in increasing order.

Even if the assumption was true you could not use that information itself
because the car could a list it self.

(make
(do h 7
(link (box))
(link (make (do j (* h h) (link (box)))))))

Reply via email to