Oh yes.... thanks Alex,
Regards,
Kashyap

On Sat, May 2, 2020 at 7:10 AM Alexander Burger <a...@software-lab.de> wrote:

> Hi Kashyap,
>
> > Could you please tell me why we have the cons(Nil, Nil); in gen3m.c right
> > after insert(&Intern, "NIL", romSym("NIL", "(Rom+1)")); ?
>
> This allocates a dummy cell, required by 'NIL'. From doc/structures you see
>
>       NIL:  /
>             |
>             V
>       +-----+-----+-----+-----+
>       |'NIL'|  /  |  /  |  /  |
>       +-----+-----+-----+-----+
>
>                   ^
>                   |
>                   This is the dummy cell
>
> This cell is needed to allow for the dual nature of NIL, being both a
> symbol and
> as a cell (= empty list). PicoLisp demands that both (car NIL) and (cdr
> NIL)
> return NIL.
>
> If you do (val NIL) or (car NIL), the CDR of the first cell is accessed,
> but for
> (cdr NIL) the access goes to the next cell in memory, i.e. the dummy cell

Reply via email to