[racket] illegal placeholder cycle

From: Doug Orleans (dougorleans at gmail.com)
Date: Sat Sep 10 23:01:49 EDT 2011

On Sat, Sep 10, 2011 at 5:16 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Tue, 6 Sep 2011 16:21:57 -0400, Doug Orleans wrote:
>> This error message is surprising:
>>
>> > (shared ((c (append null c))) c)
>> make-reader-graph: illegal placeholder cycle in value: '(#<placeholder>)
>>
>> Is it unreasonable to expect this to evaluate to null?
>
> I don't see how to get `null', although I could see an argument for
> #<undefined>: since c = (append null c) for any c, the above seems the
> same as
>
>  (shared ([c c]) c)
>
> to me.

I suppose #<undefined> is better than raising an exception.  (Which,
by the way, doesn't seem to be documented?)

I came across this while trying to define list->circular-list:

(define (list->circular-list l)
  (shared ((c (append l c))) c))

It seemed natural that the empty circular list would be null, although
I see now that the SRFI-1 definition of circular list rules out null.

--Doug



Posted on the users mailing list.