[racket-dev] shared no longer works on cons?!?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Oct 20 23:29:58 EDT 2011

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.



Posted on the dev mailing list.