Perhaps I am too stupid, but I can't get it too work to define a
function/macro that returns me the arglists of a function I pass to
it.

The ^#' seems to work only on the symbol in the script - how do I wrap
this?

Concrete problem: I have some functions that users provide and they
are supposed to be executed only if I have a value for the named
arguments

-Carsten

On 24 Feb., 20:22, "Stephen C. Gilardi" <squee...@mac.com> wrote:
> On Feb 24, 2009, at 11:59 AM, Stuart Halloway wrote:
>
> > Is there a way to programmatically retrieve the :tag of an argument?
> > The var metadata will return the tag of a return value...
>
> Yes. Here an example:
>
> user=> (source slurp)
> (defn slurp
>    "Reads the file named by f into a string and returns it."
>    [#^String f]
>    (with-open [r (new java.io.BufferedReader (new java.io.FileReader  
> f))]
>      (let [sb (new StringBuilder)]
>        (loop [c (. r (read))]
>          (if (neg? c)
>            (str sb)
>            (do
>              (. sb (append (char c)))
>              (recur (. r (read)))))))))
> nil
> user=> ^#'slurp
> {:ns #<Namespace clojure.core>, :name slurp, :file "core.clj", :line  
> 2949, :arglists ([f]), :doc "Reads the file named by f into a string  
> and returns it."}
> user=> (meta (first (first (:arglists ^#'slurp))))
> {:tag String}
> user=>
>
> --Steve
>
>  smime.p7s
> 3KAnzeigenHerunterladen

--~--~---------~--~----~------------~-------~--~----~
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