dash.el
dash.el copied to clipboard
Opposite of -applify?
-applify takes a variadic function and turns it into a function on a list. Can we have a function that takes a function on a list of similar values and turns it into a variadic function?
(defun -unapplify (fn)
(lambda (&rest args)
(funcall fn args))) ; requires lexical binding
(funcall (-unapplify (-partial '-reduce '-intersection)) '(1 2 3 4) '(2 3 4 5) '(3 4 5 6)) ; => (3 4)
Do we need such a function? And what should be its name? The question arised, when answered this question on SO.
It could go to dash functional as dash.el still does not support lexical binding. It might even be there already with different name, I'm not sure.
This is usually called curry, and -applify is usually called uncurry. I don't know what they are called in Clojure, but we should probably use their naming.