[plt-dev] Racket web page

From: Guillaume Marceau (gmarceau at gmail.com)
Date: Wed May 26 12:18:16 EDT 2010

On Wed, May 26, 2010 at 10:35 AM, engineer <engineer at alum.mit.edu> wrote:
> I think the time func is a useful tool to show off.
> Maybe use the time func to compare 2 sort algos?
> Or to show that a particular algorithm is order n-squared or log-n...

Except for the fact that time, time-apply and plot are all a bit
bothersome to use. Their interfaces aren't that polished.

(define xs (for/list ([i (in-range 0 1000000 50000)]) i))
(define ys (for/list ([x xs])
              (lambda () (time-apply sort (list (build-list x (lambda
(i) (random))) <)))
              (compose second list))))
(require plot)
(plot (points (map vector xs ys))
      #:x-min 0 #:x-max (apply max xs) #:y-min 0 #:y-max (apply max ys))

Posted on the dev mailing list.