[racket-dev] shared no longer works on cons?!?
At Fri, 21 Oct 2011 05:14:28 +0200, Shriram Krishnamurthi wrote:
> Ryan, I noticed this seems to be a problem in full Racket as well: try
>
> #lang racket
>
> (define web-colors
> (shared ([W (cons "white" G)]
> [G (cons "grey" W)])
> W))
>
> (rest web-colors)
>
> Robby privately wrote to say it should be regarded as a bug.
That is the correct behavior for `racket': `first' and `rest' work only
on lists (according to `list?', which does not include "cyclic lists").
You can use `car' and `cdr' to access the parts of arbitrary pairs.
I think `first' in ASL was intended to work on pairs, and the behavior
was apparently changed by a well-meaning attempt to improve some error
report. I'm not sure the old behavior is really the right thing, but
we'll either fix the docs or we'll fix `first'.
Meanwhile, you can use `car' and `cdr' in ASL.