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

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Thu Oct 20 23:11:52 EDT 2011

Looks like it works in 5.0.2 (November 2010) but fails in 5.1 (February 
2011).

The ultimate problem seems to be that 
deinprogramm/signature/signature-unit uses first from racket/list 
(checks list?, ie non-cyclic) rather than mzlib/list (only checks pair?).

Ryan


On 10/20/2011 08:38 PM, Shriram Krishnamurthi wrote:
> According to my class notes from last year, the following examples
> worked just fine in ASL:
>
> (define web-colors
>    (shared ([W (cons "white" G)]
>             [G (cons "grey" W)])
>      W))
>
> ; Will fail with error:
> ; (length web-colors)
>
> (check-expect (equal? web-colors (rest web-colors)) false)
> (check-expect (equal? web-colors (rest (rest web-colors))) true)
>
> (check-expect (first web-colors) "white")
> (check-expect (first (rest web-colors)) "grey")
> (check-expect (first (rest (rest web-colors))) "white")
> (check-expect (first (rest (rest (rest web-colors)))) "grey")
> (check-expect (first (rest (rest (rest (rest web-colors))))) "white")
> (check-expect (first (rest (rest (rest (rest (rest web-colors)))))) "grey")
>
> Yet none of these work any longer:
>
>> (first web-colors)
> first: expects a non-empty list; given (shared ((-0- (cons "white"
> (cons "grey" -0-)))) -0-)
>> (rest web-colors)
> rest: expects a non-empty list; given (shared ((-0- (cons "white"
> (cons "grey" -0-)))) -0-)
>
> When did this change occur?  And more importantly, what is the use of
> letting cons to be written inside shared if you can't extract it?  How
> else is one supposed to extract from cons if not using first/rest?
>
> (Oddly, list-ref seems to work for extraction even though first and
> rest do not.  I can anticipate numerous questions -- to which I don't
> know the answer -- as to why this is the case.)
>
> Several of my next few lectures depend on this working, so I'm a
> little dismayed by this.
>
> Shriram
> _________________________________________________
>    For list-related administrative tasks:
>    http://lists.racket-lang.org/listinfo/dev



Posted on the dev mailing list.