Re: [racket-dev] shared no longer works on cons?!?
Yeah, I caught that in the patch, thanks. I think it's the lesser of two evils for me right now (to export car as first, etc), and the price here is indeed very low. But thanks for the reminder, so I'm alert to it. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
FWIW, the reason for the change to the teaching languages was so that 'first' doesn't say "car" in its error message. Robby On Thu, Oct 20, 2011 at 10:46 PM, Shriram Krishnamurthi wrote: > Thanks for the help with the patch. But because I'm providing my own > language, I think there's a cleaner solution. > > I anyway planned to release a new version of the course language in > the morning that turned on shared printing, so this would mesh nicely. > > Shriram > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
Thanks for the help with the patch. But because I'm providing my own language, I think there's a cleaner solution. I anyway planned to release a new version of the course language in the morning that turned on shared printing, so this would mesh nicely. Shriram _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
On 10/20/2011 09:24 PM, Robby Findler wrote: On Thu, Oct 20, 2011 at 10:11 PM, Ryan Culpepper wrote: Looks like it works in 5.0.2 (November 2010) but fails in 5.1 (February 2011). You're talking about in the teaching languages, right? Right, I was talking about just the teaching languages. > In #lang racket, I see the first-produces-error behavior back to 5.0: [robby@penghu] /Applications/Racket v5.0.2/bin$ ./racket Welcome to Racket v5.0.2. (first (shared ((x (cons 1 x))) x)) first: expected argument of type; given #0='(1 . #0#) At least for the racket language, this seems to go back at least as far as 5.0: [robby@penghu] /Applications$ ./Racket\ v5.0/bin/racket Welcome to Racket v5.0. (first (shared ((x (cons 1 x))) x)) first: expected argument of type; given #0='(1 . #0#) This behavior in the racket/scheme languages goes back to at least PLT Scheme 4.2, and probably as long as scheme/list has existed. Ryan _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
Since I'm anyway providing my own custom language, can I provide car as first and cdr as rest? Can you think of any unexpected consequences offhand that would prevent that? (The only one I can think of so far is that second and friends don't work either, so I have to provide first, second, ... tenth afresh in terms of cad*r.) Shriram _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
On Thu, Oct 20, 2011 at 10:29 PM, Matthew Flatt wrote: >> Robby privately wrote to say it should be regarded as a bug. > > That is the correct behavior for `racket': [...] Just in case this was not clear from my other messages, I still consider this a bug (not in #lang racket). Our customers (like Shriram in this case) expect things to behave in a consistent way and we should support them in that. IMO. Robby _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
Shriram, In case you didn't follow the implication of Ryan's message, you can the diff below to your tree and your program below will run (I tested by applying the diff to the latest git version, but I think it will still work for 5.1.3.) If you wish, you can make a .plt file that you can distribute to your students via a web page (they would have to use File|Install .plt file to install it), that will also apply this diff to their installations of 5.1.3 (I suggest you also put something into the .plt file that changes the version number to avoid possible confusion). I hope this helps. Robby [robby@yanpu] ~/git/plt/collects/deinprogramm$ git diff diff --git a/collects/deinprogramm/signature/signature-unit.rkt b/collects/deinprogramm/signature/si index 2059bb7..c608317 100644 --- a/collects/deinprogramm/signature/signature-unit.rkt +++ b/collects/deinprogramm/signature/signature-unit.rkt @@ -5,7 +5,7 @@ (require scheme/promise mzlib/struct - (only-in racket/list first rest) + (only-in mzlib/list first rest) (for-syntax scheme/base) (for-syntax stepper/private/shared)) [robby@yanpu] ~/git/plt/collects/deinprogramm$ On Thu, Oct 20, 2011 at 9: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 > _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [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. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
On Thu, Oct 20, 2011 at 10:27 PM, Ryan Culpepper wrote: > On 10/20/2011 09:14 PM, 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. > > There seem to be conflicting intentions somewhere. Perhaps the racket/list > checks were really intended to use proper-or-cyclic-list?... except that I > think they were also put in place with the idea that list? was amortized > constant time (cached in the pair header bits). I know Eli had to make the > lazy version of first different for roughly the same reason, so maybe he can > say whether this issue was considered for racket or the teaching languages. Conflicting intentions aside, I think that this is a bug. At best, it is a failure to document a change in the behavior, but I think it is probably just a bug. (See the commit message) Robby _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
On 10/20/2011 09:14 PM, 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. There seem to be conflicting intentions somewhere. Perhaps the racket/list checks were really intended to use proper-or-cyclic-list?... except that I think they were also put in place with the idea that list? was amortized constant time (cached in the pair header bits). I know Eli had to make the lazy version of first different for roughly the same reason, so maybe he can say whether this issue was considered for racket or the teaching languages. Ryan _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
On Thu, Oct 20, 2011 at 10:11 PM, Ryan Culpepper wrote: > Looks like it works in 5.0.2 (November 2010) but fails in 5.1 (February > 2011). You're talking about in the teaching languages, right? In #lang racket, I see the first-produces-error behavior back to 5.0: [robby@penghu] /Applications/Racket v5.0.2/bin$ ./racket Welcome to Racket v5.0.2. > (first (shared ((x (cons 1 x))) x)) first: expected argument of type ; given #0='(1 . #0#) At least for the racket language, this seems to go back at least as far as 5.0: [robby@penghu] /Applications$ ./Racket\ v5.0/bin/racket Welcome to Racket v5.0. > (first (shared ((x (cons 1 x))) x)) first: expected argument of type ; given #0='(1 . #0#) > 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?). This looks like it was the commit that changed the behavior for the teaching languages: http://git.racket-lang.org/plt/commitdiff/c7d67f9babc2496aaf295a08264b79750785314b and judging from the commit message, the change in behavior was not intentional. Robby _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
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. Shriram _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
Re: [racket-dev] shared no longer works on cons?!?
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 _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev
[racket-dev] shared no longer works on cons?!?
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