How can I find the problem # 58?

This is something I was looking right now. What's the best order to follow?
I know I can sort by complexity but I think there should be a better way to
sort them.

Thanks

On Sat, Aug 25, 2012 at 1:05 PM, Bronsa <[email protected]> wrote:

> its*
>
>
> 2012/8/25 Bronsa <[email protected]>
>
>> check out clojure.core/comp, and it's source
>>
>>
>> 2012/8/25 John Holland <[email protected]>
>>
>>> This problem is really confusing me. I found a solution online, but I
>>> can't understand the solution. Can anyone explain to me why this
>>> works?
>>>
>>> The problem is stated as:
>>>
>>>
>>>
>>> Write a function which allows you to create function compositions. The
>>> parameter list should take a variable number of functions, and create
>>> a function applies them from right-to-left.
>>> (= [3 2 1] ((__ rest reverse) [1 2 3 4]))
>>> (= 5 ((__ (partial + 3) second) [1 2 3 4]))
>>>
>>>
>>> The examples would accept the solution replacing the ____.
>>>
>>> The solution I found is:
>>>
>>> (fn [x & xs]
>>>   (fn [& args]
>>>     ((fn step [[f & fs] a]
>>>        (if fs
>>>          (f (step fs a))
>>>          (apply f a)))
>>>      (cons x xs) args)))
>>>
>>>
>>> This works, and baffles me when I try to understand it.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to [email protected]
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>>
>>
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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

Reply via email to