[racket] Help with filter-map
I created some Racket solutions to ProjectEuler #71. Below is one that
uses filter and map:
(define (euler71c)
(numerator (apply max (filter (λ (n) (> (/ 3 7) n)) (map (λ (n) (/ (floor
(/ (* n 3) 7)) n)) (stream->list (in-range 2 1000000)))))))
1) I thought I might speed it up by using filter-map, but I cannot
understand how to do it. I read the 1 line I could find in the reference
and it just doesn't help me
2) The code above takes about 4x the time of a simple for loop
implementation. What can I do to speed it up?
Thanks,
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120527/183a270b/attachment.html>