[racket] spirit of Racket?
Impressive improvement! Thanks Matthias.
-Joe
On Sun, Mar 11, 2012 at 4:14 PM, Matthias Felleisen <matthias at ccs.neu.edu>wrote:
>
> I believe the code below cuts your running time to one third. -- Matthias
>
> #lang racket
>
> (require srfi/13)
>
> (define (euler4e)
> (for*/fold ([greatest 0]) ([first (in-range 101 1000)] [second (in-range
> first 1000)])
> (define prod (* first second))
> (if (palindromic? prod) (max greatest prod) greatest)))
>
> (define (palindromic? n)
> (define s (number->string n))
> (define r (string-reverse s))
> (string=? s r))
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120311/71e247ac/attachment.html>