Got it. Thanks Alex.

I was going to ask this later when I got to it, but since you mentioned I
am curious though ... how's hash table implemented without array?

Regards,
Kashyap

On Fri, Mar 8, 2019 at 11:02 PM Alexander Burger <[email protected]>
wrote:

> Hi Kashyap,
>
> > I am having some trouble following what's going on in the in the intern
> > logic. It took me some time to realize that Intern[2] was essentially
> > forming the node of a binary tree :)
>
> Correct, at least in pil64 and miniPicoLisp (in pil32 and Ersatz it is a
> hash
> table).
>
>
> > What's the purpose of the tables - Ascii6 and Ascii7? I tried looking
> for a
> > writeup on string/symbol implementation but couldn't find it.
>
> This is only in miniPicoLisp. To save space, it packs text in six or seven
> bits
> per character. This is specified in miniPicoLisp/doc/structures
>
>       ASCII-6/7 -> 96 characters:
>           xxxxx0     NUL sp ./<> a-z
>          xxxxxx1     !"#$%&'()*+,- 0-9 :;=?@ A-Z [\]^_`{|}~
>
> As you see, the distinction is made on bit zero. Presumably often used
> characters occupy only 6 bits.
>
>
> > In the the intern function there is a isTxt if block - is a symbol ever
> not
> > txt?
>
> Yes. We must distinguish between a symbol (a structure composed of at
> least one
> cell) and its name (a bit pattern, basically a number).
>
> The name in miniPicoLisp can either be 'txt' if it is short (again, see
> miniPicoLisp/doc/structures)
>
>               sym
>               |
>               V
>         +-----+-----+
>         | txt | val |
>         +-----+-----+
>
> or of arbitrary size
>
>                sym
>                |
>                V
>          +-----+-----+
>          |  |  | val |
>          +--+--+-----+
>             | tail (only name, no properties)
>             V
>       +-----+-----+
>       | bin |  |  |
>       +-----+--+--+
>                |
>                V
>          +-----+-----+
>          | bin |  |  |
>          +-----+--+--+
>                   |
>                   V
>             +-----+-----+
>             | bin | num |
>             +-----+-----+
>
> - Alex
>
> --
> UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
>

Reply via email to