Created
November 30, 2023 05:08
-
-
Save bhurlow/60746a70cdf563d6847802cfec7821ee to your computer and use it in GitHub Desktop.
java.util.Function converion macros
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro as-function [f] | |
`(reify java.util.function.Function | |
(apply [this arg#] | |
(~f arg#)))) | |
(defmacro as-consumer [f] | |
`(reify java.util.function.Consumer | |
(accept [this arg#] | |
(~f arg#)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment