From: Ken A. <kan...@bb...> - 2004-07-19 16:13:52
|
At 11:54 AM 7/19/2004 -0400, Alan Donovan wrote: >On Mon, Jul 19, 2004 at 11:24:26AM -0400, Ken Anderson wrote: >> Tim, i'd like to propose this as a new definition of eqv? >> (define (atomicClass? c) >> (or (eq? c Boolean.class) >> (eq? c Byte.class) >> (eq? c Short.class) >> (eq? c Integer.class) >> (eq? c Long.class) >> (eq? c Float.class) >> (eq? c Double.class) >> (eq? c Symbol.class))) > >(and don't forget Character.class) > > >> (define (eqv? x y) >> (or (eqv? x y) >> (let ((c (.getClass x))) >> (and (atomicClass? c) >> (eq? c (.getClass y)) >> (.equals x y))))) > >I think there's a typo for 'eq?' on line 2. > >What about the #null value? This would (unfortunately) require extra >cases because (.getClass #null) fails. > > >> You're using case incorrectly. Your code expands into: >> (let ((temp var (String. "foo"))) >> (cond ((member temp var '(String. "foo")) #t) >> (else #f))) > >Right. I'm relatively new to Scheme ;-) Bit you're good enough to find errors in my code! >Thanks for your help! (Sorry if my comments above are pedantic.) >I'll subscribe to the list. Questions and comments are always welcome! BTW, i should mention to the group that Alan gave a great talk at BBN last week on JDK 1.5 and automatic conversion of 1.4 code to 1.5: http://pag.csail.mit.edu/~adonovan/pubs/slides-bbn-jul04.pdf |