thanks mand
On Friday, February 1, 2013 12:41:44 AM UTC-2, Zack Maril wrote:
>
> Take a look at this gist:
> https://gist.github.com/4688693
>
> It uses memoize to eek out a little bit more performance.
> λ ~/Projects/experiments/collatz > lein run
> Compiling collatz.core
> [9 19]
> "Elapsed time
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:
>>
>> Given two maps
>> (def mario {:color "r
amalloy, inspirational as always! thank you
On Fri, Feb 1, 2013 at 11:08 AM, 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:
>>
>> Given two ma
(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:
>
> Given two maps
> (def mario {:color "red" :power 45})
> (def luigi {:color "green" :power 40})
>
> I want the max between b
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
Take a look at this gist:
https://gist.github.com/4688693
It uses memoize to eek out a little bit more performance.
λ ~/Projects/experiments/collatz > lein run
Compiling collatz.core
[9 19]
"Elapsed time: 30.236 msecs"
[97 118]
"Elapsed time: 5.532 msecs"
[871 178]
"Elapsed time: 22.529 msecs"
[61
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,