Note to self: Randomize a list in Scheme

Using PLT Scheme, I wanted to randomize a list. Here is what I came up with:
(define (random-sort l)
(sort l
(lambda (x y)
(equal? 0 (random 2)))))

0 comments:

Post a Comment