[racket] on reversing a list by way of sort

From: David Van Horn (dvanhorn at cs.umd.edu)
Date: Mon Sep 15 16:53:50 EDT 2014

I don't think you made enough examples.

On 9/15/14, 4:48 PM, Daniel Bastos wrote:
> 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
> 


Posted on the users mailing list.