On Thu, Jan 22, 2009 at 1:20 PM, Peter Wolf <[email protected]> wrote:
>
> Here's a dumb question which has been answered before... but I can't
> find it in the docs.
user=> (map (meta (var take)) [:file :line])
("core.clj" 1434)
Which is to say, the file and line number are stored in the metadata of
the Var. The namespace, docstring, and other useful tidbits are there
too.
This information is used by the clojure.contrib.repl-utils/source macro:
user=> (source take)
(defn take
"Returns a lazy seq of the first n items in coll, or all items if
there are fewer than n."
[n coll]
(when (and (pos? n) (seq coll))
(lazy-cons (first coll) (when (> n 1) (take (dec n) (rest coll))))))
nil
--Chouser
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---