Dear Racketeers, I was studying the exercise 20.2.4 of HtDP when I came up
with this way of reversing lists. (Every element is a least element. Or
greatest.)

(define (f x y)
  true)

(define (rev ls)
  (sort ls f))

Welcome to DrRacket, version 6.0.1 [3m].
Language: Intermediate Student; memory limit: 256 MB.
> (rev (list 1 3 4))
(list 4 3 1)
> (rev '(a b c d))
(list 'd 'c 'b 'a)
>

Now I'm feeling like an expert. (But my friends still call me Danewbie.)
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to