[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected case behavior



On Feb 12, Bertrand Petit wrote:
> 
> 	I'm surprised by the behaviour of CASE in DrScheme. The
> following expressions evaluates to #t but I expected them to evaluate
> to "toto". Am I wrong? Or is this a bug?

The arguments in the constant list of case are not evaluated, so
writing

  (case 'toto (('toto) "toto") (else 'foo))

is the same as

  (case 'toto (((quote toto)) "toto") (else 'foo))

What yyou want is:

  (case 'toto ((toto) "toto") (else 'foo))

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!