Hi List, 

I try to figure out if it would be possible to map circular lists from
Emacs Lisp to PicoLisp. Here is a quote from the Emacs Lisp manual :

#+begin_quote
If the cdr of a list's last cons cell is some value other than nil, we call
the structure a dotted list, since its printed representation would use dotted
pair notation (see Dotted Pair Notation). There is one other possibility: some
cons cell's cdr could point to one of the previous cons cells in the list. We
call that structure a circular list.
#+end_quote

In PicoLisp, the cdr of a circular list always seems to point to the beginning
of the list. In Emacs Lisp the term 'shared structures' is used too, and 'the
cell's cdr could point to one of the previous cons cells in the list', not
only to the beginning of the list. 

The syntax for this looks like this (again from the Emacs Lisp manual):

#+begin_quote
To represent shared or circular structures within a complex of Lisp objects,
you can use the reader constructs ‘#n=’ and ‘#n#’.

Use #n= before an object to label it for later reference; subsequently, you
can use #n# to refer the same object in another place. Here, n is some
integer. For example, here is how to make a list in which the first element
recurs as the third element:

     (#1=(a) b #1#)

#+end_quote

Thus, somewhere in a nested list, an object is labelled for later use (not
necessarily the beginning of the list), and later it is referred to one or
several times (not necessarily at the end of the list), e.g.

#+begin_src emacs-lisp
  (:parent #5=(headline ...
  ...  :parent #5#)
#+end_src

I wonder how this can be expressed in PicoLisp?

-- 
cheers,
Thorsten

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

Reply via email to