On Thu, Feb 23, 2012 at 11:47 AM, Prabhakar Ragde <plra...@uwaterloo.ca> wrote:
> Neil Toronto wrote:
>
>> What's your favorite not just computable, but tweetable function?
>
>
> (define (r n)
>  (for/fold ([s 1] [l '()]) ([i n])
>    (values (/ 1 (- (* 2 (floor s)) s -1)) (cons s l))))
>
> I tweeted this to make sure it fit. I had 23 characters to spare, could
> squeeze a bit of whitespace out, then use the rest to make it more elegant,
> but I have actual work to do... --PR

What is this thing? It seems coolly symmetric in this view:

(require plot)
(plot (points (let-values ([(n l) (r (expt 2 12))])
                (for/list ([i (in-naturals)]
                           [x (in-list l)])
                  (vector i x)))))

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to