Last active
February 22, 2018 01:37
-
-
Save mszajna/c32c02811deb69f42df38d7bd4054ebe to your computer and use it in GitHub Desktop.
Clojure record that is also a function
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
(defrecord Foo [state] | |
clojure.lang.IFn | |
(invoke [this] | |
(println "my state is" state))) | |
;; Try it out! | |
((->Foo "foo")) | |
my state is foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment