Here you can peek at the source code of clojure.
http://code.google.com/p/clojure/source/browse/trunk/src/clj/clojure/core.clj
It is about 3700 lines, and although you have to get used to a few new
functions and names that are normally not exposed when you use
clojure, it looks fairly simple.
Here is the function that defines defn itself. Most functions in the
source are a magnitude easier than this one for us newbies =).
(def
#^{:doc "Same as (def name (fn [params* ] exprs*)) or (def
name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
to the var metadata"
:arglists '([name doc-string? attr-map? [params*] body]
[name doc-string? attr-map? ([params*] body)+ attr-
map?])}
defn (fn defn [name & fdecl]
(let [m (if (string? (first fdecl))
{:doc (first fdecl)}
{})
fdecl (if (string? (first fdecl))
(rest fdecl)
fdecl)
m (if (map? (first fdecl))
(conj m (first fdecl))
m)
fdecl (if (map? (first fdecl))
(rest fdecl)
fdecl)
fdecl (if (vector? (first fdecl))
(list fdecl)
fdecl)
m (if (map? (last fdecl))
(conj m (last fdecl))
m)
fdecl (if (map? (last fdecl))
(butlast fdecl)
fdecl)
m (conj {:arglists (list 'quote (sigs fdecl))} m)]
(list 'def (with-meta name (conj (if (meta name) (meta name)
{}) m))
(cons `fn fdecl)))))
On Jan 13, 8:51 am, HB <[email protected]> wrote:
> Hey,
> How much Clojure source code is complicated?
> I'm not a programming Godfather but I would like to study Clojure
> source code.
> Could an intermediate programmer like me grasp the source code?
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---