Hi Arie,

> Playing around I got this surprise:
> I wanted to set variable x to value '(1 2 3 4):
> 1. first try (without RTFM):
> ...
> 2. second try (superficially RTFM)
> ... 
> 3. third try (now RTFM)

Yeah, as you see, PicoLisp is radically different both from CL and Scheme :)


>    : (de x . '(1 2 3 4))
>    : x
>    -> '(1 2 3 4)
> 
>    Bingo! I now can see a master plan to keep the number of
>    functions limited, but more versatile.

1. Note that normally you set a symbol value with either 'setq' or 'let'.

      : (setq x (1 2 3 4))
      -> (1 2 3 4)
      : x
      -> (1 2 3 4)


2. Also, are you sure you want the quote here? As can be seen above, lists
   starting with a number don't need to be quoted at all.

   But as 'de' does not evaluate its arguments, what you actually did was
   setting 'x' to the 5-element list (quote 1 2 3 4).


3. A dot followed by a list is just a list:

      : (de x . (1 2 3 4))

   is the same as

      : (de x 1 2 3 4)

   In both cases:
      : x
      -> (1 2 3 4)


4. 'de' is basically like a non-evaluating 'setq' with checks for changes:

      : (de x 5 6 7)  # Changed value!
      # x redefined   # gives a redefined message
      -> x

      : x
      -> (5 6 7)

I hope this clears up things a little ;)
♪♫ Alex

-- 
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to