eqv?, to be exact.  Your case statement works fine for me, with for example 
(comp->text '=).  (eq? comp =) compares against the value of the procedure =, 
whereas the case compares against the symbol =.  So you are doing two different 
comparisons.

You can use ,x (case ...) at the REPL to see what the case expands to.

Fake edit: Kon said this more succinctly than I did.
Jim

On Mar 2, 2012, at 5:52 PM, Matt Welland wrote:

> I expected this to work:
> 
> (define (comp->text comp)
>   (case comp
>    ((=)    "=")
>    ((>)    ">")
>    ((<)    "<")
>    ((>=)  ">=")
>    ((<=)  "<=")
>    (else "unk")))
> 
> But had to convert to a cond with (eq? comp =) etc...
> 
> I thought case was supposed to use eq? to do the compare?

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to