How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Leandro Moreira
The problem is known as Collatz Conjecture (also 3n + 1 conjecture). Basically given a n number then you apply the following rule. If n is even then n/2 otherwise 3 * n + 1, you keep applying this until you reach the number 1. For instance, starting with *n = 6*, one gets the sequence 6, 3, 10,

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-01-31 Thread Leandro Moreira
Running through this problem I also faced the weird situation, so: Given two maps (def mario {:color "red" :power 45}) (def luigi {:color "green" :power 40}) I want the max between both but based on :power key. It would be something like this. (max mario luigi) I expect max return not only 45 bu

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Leandro Moreira
thanks On Friday, February 1, 2013 8:08:20 AM UTC-2, Alan Malloy wrote: > > (max-key :power mario luigi) > > On Thursday, January 31, 2013 6:08:21 PM UTC-8, Leandro Moreira wrote: >> >> Running through this problem I also faced the weird situation, so: >> >>

Re: How to solve Collatz Conjecture problem for huge numbers using clojure parallelism tricks?

2013-02-01 Thread Leandro Moreira
} > "Elapsed time: 8.1 msecs" > {:n 871, :count 178} > "Elapsed time: 31.023 msecs" > {:n 6171, :count 261} > "Elapsed time: 144.956 msecs" > {:n 77031, :count 350} > "Elapsed time: 944.857 msecs" > {:n 837799, :count 524} > &quo

How to use pmap over a partition-all list of list?

2013-02-02 Thread Leandro Moreira
Hi there, I have this: *user=>* (partition-all 5 (range 1 20)) ((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17 18 19)) And I would like to apply the *pmap* over the partitions, something like: (the line bellow doesn't work) *user=>* (pmap + (partition-all 5 (range 1 20))) *I would like to ha

Re: How to use pmap over a partition-all list of list?

2013-02-02 Thread Leandro Moreira
s you yourself said you can use 'apply' instead of reduce > > Jim > > > > On 02/02/13 12:31, Leandro Moreira wrote: > > Hi there, > > I have this: > > *user=>* (partition-all 5 (range 1 20)) > ((1 2 3 4 5) (6 7 8 9 10) (11 12 13 14 15) (16 17

Re: How to use pmap over a partition-all list of list?

2013-02-02 Thread Leandro Moreira
Thanks all, you were really helpful ! -- -- 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 unsub

Can I use clojure's logo to write an article to a magazine?

2012-02-29 Thread Leandro Moreira
Hi, I didn't find what license is owned by logo of Clojure and I would like to use it on a magazine article. I saw a conversation, not conclusive, in which Rich Hickey (or his brother) gives the permission for a guy but it wasnt clear about the current license that rule the logo. Do you have any

Clojure and long auto-promotion to big decimal

2012-02-07 Thread Leandro Moreira
I thought clojure always did auto promotion between long and bigdecimal, but I run repl today and I notice this: (* 1000 1000 1000 1000 1000 1000 1000) raises overflow (* 1000M 1000M 1000M 1000M 1000M 1000M 1000M) this is ok So this was always working that way? or they've changed? (and if yes, wh