From: Danny Yoo (dyoo at cs.wpi.edu) Date: Thu Feb 23 14:01:38 EST 2012 |
|
The following code is bigger than the limit, but I've always thought it was cute: #lang racket ;; see: http://mail.python.org/pipermail/tutor/2001-April/004888.html (define (a n) (* 2 n (add1 (* 2 n)))) (define (b x y) (if (<= (abs x) (abs y)) (+ (a (- y)) (abs (- y x))) (- (a (- x)) (abs (- y x))))) (for* ([y (in-range 5 -5 -1)]) (for ([x (in-range -5 5)]) (printf "~a\t" (b x y))) (newline))
Posted on the users mailing list. |
|