[racket] on reversing a list by way of sort
On Tue, Sep 16, 2014 at 12:34 AM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:
>
> Ah, you're right. I actually tried visualizing Racket's shuffle using
> picts and didn't notice any streaks so I was puzzled. That explains it.
The equivalent of Racket's shuffle on that page is the "sort (random
order)", except that their version depends on a continuous range of
integers (which the visualization always does).
On Tue, Sep 16, 2014 at 12:40 AM, Matthew Butterick <mb at mbtype.com> wrote:
>
> And here's the evil random-comparator shuffle, which you write thus: (sort l
> (λ(a b) (< (random) 0.5)) #:cache-keys? #t)
(There's no need for caching the keys here.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!