小编syn*_*ync的帖子

定义Comp时为什么会这么多?

Clojure本身的core.clj代码(可在https://github.com/clojure/clojure/blob/clojure-1.7.0/src/clj/clojure/core.clj获得)给出了以下定义comp:

    (defn comp
     "Takes a set of functions and returns a fn that is the composition
       of those fns.  The returned fn takes a variable number of args,
       applies the rightmost of fns to the args, the next
       fn (right-to-left) to the result, etc."
       {:added "1.0"
        :static true}
       ([] identity)
       ([f] f)
       ([f g] 
          (fn 
            ([] (f (g)))
            ([x] (f (g x)))
            ([x y] (f (g x y)))
            ([x y z] (f (g x y z))) …
Run Code Online (Sandbox Code Playgroud)

clojure

3
推荐指数
1
解决办法
120
查看次数

标签 统计

clojure ×1