On Thu, Jan 22, 2009 at 1:20 PM, Peter Wolf <opus...@gmail.com> 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 clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to