Guest User

Untitled

a guest
Feb 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. (defn curryfun [arity fun]
  2. (fn [& args]
  3. (let [argcount (count args)]
  4. (cond (= arity argcount)
  5. (apply fun args)
  6. (< argcount arity)
  7. (curryfun (- arity argcount)
  8. (fn [& args2] (apply fun (concat args args2))))
  9. (> argcount arity)
  10. (apply (apply fun (take arity args))
  11. (drop arity args))))))
Add Comment
Please, Sign In to add comment