nulil

使用方法: (partial f & args)

clojure.core/partialのように動作
第一引数は、第二引数以降を受け取る関数
(fn [s & more] (apply f s (concat args more))))に展開される。

例:

1 (use '[clojure.contrib.str-utils2 :only (partial)])
2 (partial clojure.contrib.str-utils2/take 2)
3 ;;=> (fn [s] (str-utils2/take s 2))
 1 user=> (use '[clojure.contrib.str-utils2 :only (partial)])
 2 WARNING: partial already refers to: #'clojure.core/partial in namespace: user, being replaced by: #'
 3 clojure.contrib.str-utils2/partial
 4 nil
 5 user=> (partial clojure.contrib.str-utils2/take 2)
 6 #< str_utils2 $partial$fn__412 clojure.contrib.str_utils2/$partial$fn__412@1716fa0>
 7 user=> ((partial clojure.contrib.str-utils2/map-str) #(.toUpperCase %)  ["abc" "def" "ghi"] )
 8 "ABCDEFGHI"
 9 user=> ((partial clojure.contrib.str-utils2/map-str ["abc" "def" "ghi"]) #(.toUpperCase %)  )
10 "ABCDEFGHI"
11 user=> (map (partial concat "a") ["1" "2" "3"])
12 ((\1 \a) (\2 \a) (\3 \a))
13 user=> ( (partial concat "a") ["1" "2" "3"])
14 ("1" "2" "3" \a)