Terrier accepted answer is absolutely correct. But you can make it a little easier to use with a first-order function:
(defn ^java.util.function.Function as-function [f]
(reify java.util.function.Function
(apply [this arg] (f arg)))
or macro:
(defmacro jfn [& args]
`(as-function (fn ~@args)))
source
share