On Tue, 3 May 2011, Andrzej wrote:
> In my implementation I've implemented 'cond' so that it recognizes
> 'else' by looking at the name of the symbol. If I have to fix it I'd
> like to know what the correct version is, why it is correct and why my
> implementation is wrong.
Here is a good example illustrating the problems of your proposed
implementation.
Consider the following inline macro that converts a Scheme value to its boolean
representative:
(define-syntax convert-to-boolean
(syntax-rules ()
((_ exp)
(cond (exp #t)
(else #f)))))
Now imagine a user who knows that there are no reserved words in Scheme
and who knows nothing of the implementation of convert-to-boolean
does the following:
(let ((else #f))
(convert-to-boolean else))
What answer should he get?
What answer would he get in your implementation?
Andre
_______________________________________________
Scheme-reports mailing list
[email protected]
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports