Permalink
Browse files

added flip, partial*

  • Loading branch information...
CKevinZ committed Oct 17, 2012
1 parent be84d36 commit fdfa3cb5aca8f0b7a0309d193846fbd47cb9fde6
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/clj/clojure/core.clj
View
@@ -2385,6 +2385,19 @@
([f arg1 arg2 arg3 & more]
(fn [& args] (apply f arg1 arg2 arg3 (concat more args)))))
+(defn flip
+ "Flips the given function arguments."
+ {:added "1.4"}
+ [f]
+ (comp (partial apply f) reverse list))
+
+(defn partial*
+ "Flips the given function arguments and returns a new function
+ partially applied to a variable number of arguments."
+ {:added "1.4"}
+ [f & args]
+ (apply partial (flip f) args))
+
;;;;;;;;;;;;;;;;;;; sequence fns ;;;;;;;;;;;;;;;;;;;;;;;
(defn sequence
"Coerces coll to a (possibly empty) sequence, if it is not already

0 comments on commit fdfa3cb

Please sign in to comment.