user> (macroexpand-1 '(defn foo [x] (inc x)))
(def foo (clojure.core/fn ([x] (inc x))))
user> (defn bar [] (fn ([x] (inc x))))
#'user/bar
user> (def foo (bar))
#'user/foo
user> foo
#function[user/bar/fn--10778]
user> (defn foo [x] (inc x))#'user/fooIllegalStateException Attempting to call unbound fn: #'p.core/default-step clojure.lang.Var$Unbound.throwArity (Var.java:43)
p.core> default-step
#function[p.core/make-step/fn--10747]
(defn make-step [some-args]
(fn ([other-args]
(some-body using-both-args))))(defn bar [] (fn ([x] (inc x))))Use the source, Luke!
Spend some quality time with the source code of deftype, defrecord, ns, etc. and you will not regret it. Monkey with the ns- functions to explore namespaces, interning, etc. Make sure you grok the relation between vars and values. Once you get the hang of how Clojure does it you'll find it easy to roll your own.
You will almost certainly want to use some macros, but what's wrong with that?
gregg