Hi JmageK,

> The previous mail quizzed me about, the (set (nth u 5) 1000) part.
> I understand it basically setting a value at a certain place like u[5] = 1000
> in c like languages. nth returns a list starting from count and set evaluates
> then sets the value of variable.

The important point to understand here is that a "variarle" in PicoLisp can
either be a symbol or a cell in a list.

>From doc/ref.html#fun, primary data types:

   var - Variable: Either a symbol or a cons pair


> : (cdadr (cdadr incM))-> (0)

This returns a single cell, which may then destructively modified with 'set',
'inc', 'pop' or whatever function accepts a 'var' argument.


Internal background: 'set' gets a pointer to a part of a cell. For a list cell
this it

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

i.e. the CAR if a cell, while for a symbol it is

            |
            V
      +-----+-----+                                +-----+-----+
      |     | VAL |                                |'cba'|'fed'|
      +-----+-----+                                +-----+-----+

i.e. the VAL (value) of a symbol.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to