[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can s-exprs represent a graph without eval?



I've never seen this, it's certainly interesting, but how to you detect 
that you're just going around in circles?
(Let's say someone passes you v and you aren't suspecting v has this 
structure.)

Geoffrey
--
Geoffrey S. Knauth | http://knauth.org/gsk

On Thursday, Jun 19, 2003, at 13:58 US/Eastern, Shriram Krishnamurthi 
wrote:

> Many extensions to Scheme support this, and I imagine they probably
> obtained their notation from (Common?) Lisp.  In Chez Scheme, PLT
> Scheme and others, you can write programs such as this:
>
>> (define v '#0=(a . #0#))
>
> so that
>
>> (car v)
>   a
>> (cadr v)
>   a
>> (caddr v)
>   a
>
> and
>
>> (cdr v)
>   #0=(a . #0#)
>
> In general, #n= binds while #n# refers.
>
> Shriram