Is it possible to create a macros that knows from what function it was
called and what variables (bindings) are defined in the caller
function?

For example following python code defines function print_env that
prints name of function that called print_env() along with local
variables of those function.

In [60]: def print_env(): f = sys._getframe(1); print "in print_env().
name:", f.f_code.co_name, "locals:", f.f_locals

In [61]: def my_func(arg1, arg2='value'): var1='var1'; print_env();
var2='var2'

In [62]: my_func('x')
in print_env(). name: my_func locals: {'arg1': 'x', 'arg2': 'value',
'var1': 'var1'}


Python does this in run-time, is it possible to do same with Clojure
in compile-time?

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

Reply via email to