Hi Alexis,

> The "Symbols" section of the PicoLisp Reference Manual:
> http://software-lab.de/doc/ref.html#symbol
> seems to have the convention:
> 
>    +-----+-----+ | cdr | car | +-----+-----+
> 
> whereas the "Numbers" and "Lists" sections has the convention:
> 
>    +-----+-----+ | car | cdr | +-----+-----+
> 
> which, in an English-language left-to-right document, is what i
> would expect.

No, this is not the case. In all these documentations, cells are always
displayed in the form

      +-----+-----+
      | CAR | CDR |
      +-----+-----+

The left half of the cell is the CAR, and the right half the CDR. Just
as the cell resides in memory. The CAR is at the lower address, and the
CAR at the higher.


The important point is that the pointer *TO* a PicoLisp item may point
to different parts of the cell:

1. In case of a pair (list cell) it points to the address of the CAR

      Pair
      |
      V
      +-----+-----+
      | CAR | CDR |
      +-----+-----+

2. In case of a symbol, it points to address of the CDR part of the
   cell, which holds the value of the symbol:

            Symbol
            |
            V
      +-----+-----+
      |  |  | VAL |
      +--+--+-----+

Note that still the CAR part of that cell is on the left side. It holds a 
pointer
to the symbol's tail. The CDR part of the cell holds VAL, the symbol's value.

3. Finally, a bignum cell is pointed to its "middle"

         Bignum
         |
         V
      +-----+-----+
      | DIG |  |  |
      +-----+--+--+

   That is, it points to an address *inside* the cell, not to its
   starting address.

Confusing?
♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to