See if you can put this to any use (implies no warranty) - applicable to the JVM only:
(defmacro whereami [] `(try (throw (Exception.)) (catch Exception e# ;; (.printStackTrace e#) ; uncomment this line to inspect stack trace (let [ste# (aget (.getStackTrace e#) 0)] {:class-name (.getClassName ste#) :file-name (.getFileName ste#) :line-number (.getLineNumber ste#) :method-name (.getMethodName ste#)})))) (defn foo [] (println "This is at" (whereami))) Shantanu On Saturday, 14 February 2015 21:41:48 UTC+5:30, Cecil Westerhof wrote: > > In Bash I use the following construct: > printf "${FUNCNAME} needs an expression\n" > > In this way I do not have to change the print statement when the name of > the function changes. Is something like this also possible in clojure? > > -- > Cecil Westerhof > -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.