[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] [r6rs-discuss] Scheme pattern matching: the case for (case)
Peter Kourzanov scripsit:
> (define eqv? equal?)
> (newline)
> (write (case "asd" (("asd") #t)))
> (newline)
>
> You'll find Tinyscheme, Minischeme, MIT, Scheme48/SCSH
> included in your list. Ypsilon and Stalin exhibit this
> behaviour for strings, but not for more structured data
> like vectors.
Chicken, Bigloo, Kawa, SISC, Chibi, STklos, and Scheme 9 also have this
problem; Racket, Gauche, Gambit, Guile, Chez, SCM, Larceny, Mosh, and
SSCM do not; Ikarus won't let you rebind EQV?.
However, this is a problem not of hygiene but of reusing implementation,
I think. Consider this:
(define cdr #f)
(length '(a b c))
I haven't found any Schemes except Scheme 9 on which this fails, but
there is nothing in any Scheme standard to make it work. In C, on the
other hand, the equivalent construction is not allowed to fail: fopen()
is naturally definable in terms of open(), but if you define your own open(),
it cannot affect the behavior of fopen() on conformant ISO C systems.
On the gripping hand, if you define your own length in terms of cdr
(as is natural), you will get a failure if cdr is redefined later in the
REPL.
The problem's a mess.
--
John Cowan cowan@x http://www.ccil.org/~cowan
Most people are much more ignorant about language than they are about
[other subjects], but they reckon that because they can talk and read and
write, their opinions about talking and reading and writing are as well
informed as anybody's. And since I have DNA, I'm entitled to carry on at
length about genetics without bothering to learn anything about it. Not.
--Mark Liberman
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports