align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditemptyheartfacebookfullheartglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo


From: Paul
Sent on: Thursday, March 14, 2013 11:18 AM

Last night there was a discussion about over-riding functions in Clojure where Craig suggested modifying a var to accomplish this. The idea seemed new to a couple of people, so I thought I'd post an example.

I run my own repl where I attach source forms as metadata to the objects returned (I sometimes find it useful to ask a value how I created it when I'm in a long-running repl). The trick here was to capture the original repl function (clojure.main/repl) and to set the var to refer to my own function instead. My function then calls the original, but adds in an option to evaluate the extra metadata.

If you want to see it, then it's at:

Yeah, it's messy, and a hack, but it was fast to write and it works for me.  :-)  (I also learned a bit about the repl and setting metadata for different types of objects in Clojure)


People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy