Thanks Alan,
 I have in fact realized the mistake after I posted it .. and I had posted
another message which has it the way you mentioned.
Sunil.

On Tue, Dec 7, 2010 at 11:55 PM, Alan <a...@malloys.org> wrote:

> I see you have defined a print-and-return macro; you might prefer my
> and-print:
>
> (defmacro and-print
>  "A useful debugging tool when you can't figure out what's going on:
>  wrap a form with and-print, and the form will be printed alongside
>  its result. The result will still be passed along."
>  [val]
>  `(let [x# ~val]
>     (println '~val "is" x#)
>     x#))
>
> I'm not sure what you're using the flag argument for; if it's to keep
> track of what prints belong to what statements then my automatic
> printing of the input form might be useful for you.
>
> I'd pull the (repeat blah blah blah) stuff in with-separator out into
> an optional argument, so that (a) you only have to write it once, and
> (b) you can use a different separator easily.
>
> I find the map in local-bindings pretty hard to read - what on earth
> is `'~x# for? Without trying to understand what you're doing, it seems
> like you could gain readability by replacing (list 'println [`'~x#
> x#]) with `(println ['~x# x#])
>
> On Nov 28, 12:32 am, Sunil S Nandihalli <sunil.nandiha...@gmail.com>
> wrote:
> > Hi Robert,
> >  What I had posted before was half-baked buggy code .. the following gist
> > has a few more helper debug macroshttps://gist.github.com/718725
> >
> > <https://gist.github.com/718725>This code was written when I was trying
> to
> > learn writing macros .. so any criticism is very welcome.
> > Thanks
> > Sunil.
> >
> > On Sat, Nov 27, 2010 at 11:06 PM, Robert McIntyre <r...@mit.edu> wrote:
> > > cool!  Although I think with-seperator should be spelled
> "with-separator"
> >
> > > --Robert McIntyre
> >
> > > On Thu, Nov 25, 2010 at 9:13 AM, Sunil S Nandihalli
> > > <sunil.nandiha...@gmail.com> wrote:
> > > > I just tried to re-write with-seperator without using the
> symbol-macros
> > > from
> > > > macro-utils and it seems to work fine ..
> >
> > > > On Thu, Nov 25, 2010 at 1:27 PM, Sunil S Nandihalli
> > > > <sunil.nandiha...@gmail.com> wrote:
> >
> > > >> Hello everybody,
> > > >>  I was trying to learn to write clojure macros and the code is
> posted
> > > here
> > > >> in the following link
> > > >>https://gist.github.com/715047
> > > >> There are basically three macros
> > > >> 1. with-seperator - a zero argument macro and is supposed to just
> draw a
> > > >> line to indicate beginning and ending of the execution of the body.
> > > >> 2. display-local-bindings - a function to print the local bindings
> in
> > > the
> > > >> lexical scope where the macro is called
> > > >> 3. letd - a helper macro to print the values of all the bindings
> > >  followed
> > > >> by printing of the local bindings using display-local-bindings
> > > >> The letd macro as posted works as expected but without the
> seperation
> > > line
> > > >> .  It is supposed to print the seperation line when I uncomment line
> 14
> > > and
> > > >> comment line 15 but some how this is causing the &env variable
> > > automatically
> > > >> passed with every macro to be nil display-local-binding .. but the I
> > > feel it
> > > >> is not the case .. can somebody help me understand this. This was an
> > > >> exercise to learn macro writing than to writing a letd debugging
> helper
> > > >> function..
> > > >> Thanks,
> > > >> Sunil.
> >
> > > > --
> > > > 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<clojure%2bunsubscr...@googlegroups.com>
> <clojure%2bunsubscr...@googlegroups.com<clojure%252bunsubscr...@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 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<clojure%2bunsubscr...@googlegroups.com>
> <clojure%2bunsubscr...@googlegroups.com<clojure%252bunsubscr...@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 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<clojure%2bunsubscr...@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 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