[racket] on reversing a list by way of sort

From: Daniel Bastos (dbastos at toledo.com)
Date: Mon Sep 15 16:48:08 EDT 2014

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.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140915/82a84e1d/attachment.html>

Posted on the users mailing list.