>
> (case 8
> ((8 9 10) 'hello)
> (else 'goodbye)) -> hello
>
> (case "8"
> (("8" "9" "10") 'hello)
> (else 'goodbye)) -> goodbye
case uses eqv? for its comparisons. Two strings are eqv? only if they are
the same object, not if they have the same contents. See the Racket help
desk for mo
))
2
On Sat, Sep 4, 2010 at 1:40 PM, wooks . wrote:
> One mans correct is another mans WAD (Works as Designed).
>
> > Subject: Re: [racket] Shurely Shome Mishtake
> > From: matth...@ccs.neu.edu
> > Date: Sat, 4 Sep 2010 16:29:59 -0400
> > CC: users@racket-lang.org
> > To: w
On Sat, Sep 4, 2010 at 9:40 PM, wooks . wrote:
> One mans correct is another mans WAD (Works as Designed).
The semantics of case are a bit annoying at times. To guess as the
reason for this, I suspect it is to allow efficient implementation for
switching on numbers and the like. There is cond for
One mans correct is another mans WAD (Works as Designed).
> Subject: Re: [racket] Shurely Shome Mishtake
> From: matth...@ccs.neu.edu
> Date: Sat, 4 Sep 2010 16:29:59 -0400
> CC: users@racket-lang.org
> To: woo...@hotmail.com
>
>
> No this is correct:
>
>
wooks . wrote at 09/04/2010 04:22 PM:
(case "8"
(("8" "9" "10") 'hello)
(else 'goodbye)) -> goodbye
Unfortunately, you can't use "case" on strings, for somewhat esoteric
reasons:
http://docs.racket-lang.org/reference/case.html
http://docs.racket-lang.org/reference/eval-model.html#(part._
No this is correct:
Welcome to DrRacket, version 5.0.1.5--2010-09-02(7fead28/g) [3m].
Language: Pretty Big; memory limit: 512 MB.
> (eqv? 8 8)
#t
> (eqv? "8" "8")
#f
>
Plus read the docs on case.
On Sep 4, 2010, at 4:22 PM, wooks . wrote:
> (case 8
> ((8 9 10) 'hello)
> (else 'goodbye)
No mistake. case uses eqv? for comparison (on the quoted thing in each clause).
http://docs.racket-lang.org/reference/case.html?q=case#%28form._%28%28lib._racket/private/more-scheme..rkt%29._case%29%29
Robby
On Sat, Sep 4, 2010 at 3:22 PM, wooks . wrote:
> (case 8
> ((8 9 10) 'hello)
> (els
(case 8
((8 9 10) 'hello)
(else 'goodbye)) -> hello
(case "8"
(("8" "9" "10") 'hello)
(else 'goodbye)) -> goodbye
I'm working in Pretty Big
_
For list-related administrative tasks:
http://lists
8 matches
Mail list logo