Right. But we don't let students do that! We don't even let them use ". rest" arguments for gosh sake! :-)
Todd On Sun, Aug 1, 2010 at 10:46 PM, Matthias Felleisen <matth...@ccs.neu.edu> wrote: > > On Aug 1, 2010, at 8:05 PM, Todd O'Bryan wrote: > >> In a language with typing and >> overloading, you could define two distance functions, one that takes >> two posns and another that takes four numbers, and I think this would >> be the most natural way to write distance. > > > Like this: > > (define distance > (case-lambda > ((p q) (distance (posn-x p) (posn-x q) (posn-y p) (posn-y q))) > ((x0 y0 x1 y1) (sqrt (+ (sqr (- x0 y0)) (sqr (- x1 y1))))))) > > (distance (posn 3 4) (posn 0 0)) > > > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users