Hi Jon,

> <http://www.software-lab.de/doc/ref.html#symbol>
> ...
> Can you please explain which of the boxes represent the "three
> properties"? I guess the two at the bottom are two of them ...

Correct. The third one is the single 'KEY' in between.


The explanation in "doc/ref.html" is indeed not very clear, but the text
below the diagram tries to specify it a little. Just now I also extended
it a little, in the hope that it improved.

The property list of a symbol (a possibly empty sequence of cells
between the symbol's main cell and the name (which is physically a
number)) holds either single symbols (like that 'KEY' above), or cells
with key-value pairs.

If it is only a single symbol, it is meant as a boolean property, i.e.
the value is 'T'. The property list functions will never produce a
property list cell like

         |
         V
         +-----+-----+
         |  |  |  ---+---> ...
         +--+--+-----+
            |
            V
            +-----+-----+
            |  T  | key |
            +-----+-----+

but a simple

         |
         V
         +-----+-----+
         | key |  ---+---> ...
         +-----+-----+

instead. The only reason for that is to save space.

Let's look at an example:

   : (put 'A 'a 1)   # A "normal" property
   -> 1
   : (put 'A 'f T)   # A boolean property
   -> T

   : (getl 'A)       # Get the property list
   -> (f (1 . a))

   : (show 'A)    
   A NIL
      f
      a 1
   -> A

   : (put 'A 'f 2)   # Change the value of 'f'
   -> 2

   : (getl 'A)
   -> ((2 . f) (1 . a))

   : (put 'A 'a T)   # Change the value of 'a' to boolean
   -> T

   : (getl 'A)    
   -> (a (2 . f))

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to