Skip to content

Instantly share code, notes, and snippets.

@bhurlow
Created November 30, 2023 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhurlow/60746a70cdf563d6847802cfec7821ee to your computer and use it in GitHub Desktop.
Save bhurlow/60746a70cdf563d6847802cfec7821ee to your computer and use it in GitHub Desktop.
java.util.Function converion macros
(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