Skip to content

Instantly share code, notes, and snippets.

@tomjack
Created October 8, 2010 03:55
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 tomjack/a0ed93a09f9fef44379e to your computer and use it in GitHub Desktop.
Save tomjack/a0ed93a09f9fef44379e to your computer and use it in GitHub Desktop.
user> (defrecord Foo [bar baz]
clojure.lang.IFn
(invoke [f k] (get f k))
(invoke [f k d] (get f k d)))
user.Foo
user> ((Foo. 1 2) :bar)
1
user> ((Foo. 1 2) :bing)
nil
user> ((Foo. 1 2) :bing 3)
3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment