Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boot.user=> (source partial)
- (defn partial
- "Takes a function f and fewer than the normal arguments to f, and
- returns a fn that takes a variable number of additional args. When
- called, the returned function calls f with args + additional args."
- {:added "1.0"
- :static true}
- ([f] f)
- ([f arg1]
- (fn
- ([] (f arg1))
- ([x] (f arg1 x))
- ([x y] (f arg1 x y))
- ([x y z] (f arg1 x y z))
- ([x y z & args] (apply f arg1 x y z args))))
- ([f arg1 arg2]
- (fn
- ([] (f arg1 arg2))
- ([x] (f arg1 arg2 x))
- ([x y] (f arg1 arg2 x y))
- ([x y z] (f arg1 arg2 x y z))
- ([x y z & args] (apply f arg1 arg2 x y z args))))
- ([f arg1 arg2 arg3]
- (fn
- ([] (f arg1 arg2 arg3))
- ([x] (f arg1 arg2 arg3 x))
- ([x y] (f arg1 arg2 arg3 x y))
- ([x y z] (f arg1 arg2 arg3 x y z))
- ([x y z & args] (apply f arg1 arg2 arg3 x y z args))))
- ([f arg1 arg2 arg3 & more]
- (fn [& args] (apply f arg1 arg2 arg3 (concat more args)))))
- nil
RAW Paste Data