[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I see little need
> (case (get-symbol)
> ((true) #t)
> ((false) #f)
> (else => (lambda (x) x)))
>Without the => clause in case, we have to write:
>(let ((key (get-symbol)))
> (cond ((eq? key 'true) #t)
> ((eq? key 'false) #f)
> (else key)))
Am I missing something subtle? Per this example, we only have to write
(let ((x (get-symbol)))
The only difference between this and its => equivalent is the scope of 'x'.
In cond, the => helps capture a useful value on the left-hand side of a
cond clause that is otherwise not easily captured. It seems much less
useful in a case, since the left-hand side of a case clause always
consists of literal eqv-testable constants, and the capture trivial.
The main argument for this would seem to me to be symmetry with cond.