Hi Thorsten,

> In PicoLisp, the cdr of a circular list always seems to point to the beginning
> of the list.

Yes, as far as the directy reader/printer syntax is concerned. But you
can easily specify a list where the last cell points to some other cell.

For example, in this list of 6 cells the last 3 cells form a circular
list:

   : (1 2 3 . (4 5 6 .))
   -> (1 2 3 . (4 5 6 .))
   :  (more @)          
   1         
   2
   3
   4
   5
   6
   4
   5
   6
   4
   ...

Personally, I find syntax much simpler and cleaner than using labels.


What cannot be directly expressed, however, is a pointer into a sublist
of the current list (or even into arbitrary other lists).

Here you have to resort to "labels", by setting a variable to the
(sub)list in question:

   : (1 2 (3 4 . `(setq "n1" (5 6))) 7 . `"n1")
   -> (1 2 (3 4 5 6) 7 5 6)

   : (1 2 3 ~(setq "n2" (4 5 6)))
   -> (1 2 3 4 5 6)
   : (7 8 ~"n2")                 
   -> (7 8 4 5 6)

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

Reply via email to