case is just for integers and symbols.

(case x [(eof) eof] [else "else"])

is equivalent to

(cond [(member x '(eof)) eof] [else "else"])

and

(member eof '(eof)) is #f

Because '(eof) is the same as (list 'eof) NOT (list eof)

Jay


On Mon, Apr 4, 2016 at 3:34 PM, rom cgb <romainbeck...@gmail.com> wrote:
> Hi,
>
> Trying to use eof in a case expression but it doesn't work.
>
> For example
>
>     (define (test x)
>       (case x
>         [(eof) eof]
>         [else  "else"]))
>
>
> (test eof) will then evaluate to "else" despite (equal? eof eof) evaluating 
> to #t.
>
> Why ?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to