Aviad,

Nice job!  One nitpick is that won't work for infinite sequences,
since reduce isn't lazy.  If you wanted your definitions to work for
arbitrary indexes of infinite sequences (like the Fibonacci numbers),
you could provide sequences providing successive results for the input
sequences.

I did an example at http://gist.github.com/310668

To use my a-mean-seq with the given example (numbers 1 - 10), you'd do
something like:

(nth (a-mean-seq (range 1 11)) 10)

but you could also get the arithmetic mean of the first 1000 Fibonacci
numbers (assuming a fibs function to generate them):

(nth (a-mean-seq (fibs)) 1000)


I do have a feeling I'm missing something really obvious that would
make my example simpler, so if anybody has any tips I'd be much
obliged!

- Colin


On Feb 21, 2:41 pm, Aviad Reich <avi....@gmail.com> wrote:
> Hi everyone,
>
> being a newb to clojure, my ability to contribute to is still limited.
> However, I thought I'll try starting with something simple.
>
> http://rosettacode.org/wiki/Averages/Pythagorean_meansseems straightforward
> enough, but since it's a comparative site, and implementations should be as
> idiomatic as possible, I would not post this implementation before some
> seasoned clojure programmers have a look.
>
> so here it is: (10 LOC 
> only)http://github.com/lxmonk/pastes/blob/master/Pythagorean-means.clj
>
> obviously, ANY comments will be great (including: this is all wrong - don't
> post it).
>
> Thanks,
> Aviad

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to