On Fri, Feb 11, 2011 at 10:59 AM, CuppoJava wrote:
> I realized, actually, after your post Ken, that my implementation of
> macroexpand-all does not do exactly what I want.
>
> The properties of macroexpand-all, should be:
>
> (eval some-expression) is *always* equal to (eval (macroexpand-all
> so
I realized, actually, after your post Ken, that my implementation of
macroexpand-all does not do exactly what I want.
The properties of macroexpand-all, should be:
(eval some-expression) is *always* equal to (eval (macroexpand-all
some-expression))
This is not the case in my current implementati
On Thu, Feb 10, 2011 at 11:10 PM, CuppoJava wrote:
> Your solution with map-ps is quite elegant.
Thanks. My implementation of macrolet also uses it. In fact, I wrote
my macroexpand-all as a tool to aid in developing that. It was useful
both for debugging macrolet itself and for testing which "spe
Your solution with map-ps is quite elegant. I was actually a little
annoyed that I had to deal with different data structures when walking
through Clojure code, as opposed to Lisp/Scheme code.
The doall was necessary for my use-case actually. Some of the macros I
write interact with the environmen
On Thu, Feb 10, 2011 at 11:01 AM, CuppoJava wrote:
> Thanks for all your help everyone!
>
> So I came up with an elegant solution. It was a combination of
> Meikel's codwalker solution gave me the idea to bootstrap off of
> Clojure's macroexpand system to get it to work.
>
> ;;This is a convenienc
See the clojure.walk namespace. It has macroexpand-all and walk/
prewalk functions which would make this much simpler.
That said: yes, of course there is a form that introduces lexical
bindings; it's called let (as shown in Mike Meyers's solution).
On Feb 10, 8:01 am, CuppoJava wrote:
> Thanks f
Thanks for all your help everyone!
So I came up with an elegant solution. It was a combination of
Meikel's codwalker solution gave me the idea to bootstrap off of
Clojure's macroexpand system to get it to work.
;;This is a convenience method for expanding macros. It recursively
;;macroexpands eve
On Wed, 9 Feb 2011 20:34:56 -0800 (PST)
CuppoJava wrote:
> Description: (bind-later bindings & body) and (do-binding & body)
> (bind-later) is used like a let-form, except that it doesn't
> *immediately* make the bindings available.
> The bindings become available only within (do-binding).
> (do
Hi,
On 10 Feb., 15:54, CuppoJava wrote:
> That one establishes dynamically scoped variables. Can't there be
> another Clojure function that provides lexically scoped variables?
>
> I actually don't know of any lisp/scheme system that provides a way to
> introduce lexically scoped variables at ru
Hi Meikel,
That's what I original thought I might have to do. But it seemed
overly complicated. Perhaps there's no way around it.
I have a small question about the "with-bindings" function that you
used.
That one establishes dynamically scoped variables. Can't there be
another Clojure function t
Hi,
On 10 Feb., 14:58, CuppoJava wrote:
> That's an awesome solution Meikel!
You are welcome. :)
> I forgot to specify that I want the bindings to have lexical scope
> only. But I think I can get that to work easily by modifying your
> solution.
Haha. In fact that was my first impulse. But the
That's an awesome solution Meikel!
I forgot to specify that I want the bindings to have lexical scope
only. But I think I can get that to work easily by modifying your
solution.
Thanks!
-Patrick
On Feb 10, 2:09 am, Meikel Brandmeyer wrote:
> Whoops. Misclick. Sorry
>
> Here again:
>
> (def *d
Whoops. Misclick. Sorry
Here again:
(def *deferred-bindings* {})
(defmacro do-binding
[& body]
`(with-bindings *deferred-bindings*
~@body))
(defmacro bind-later
[bindings & body]
(let [vars (map (fn [v] `(var ~v)) (take-nth 2 bindings))
values (take-nth 2 (next bindings))
Hi,
here my try:
(def *deferred-bindings* {})
(defmacro do-binding
[& body]
`(with-bindings *deferred-bindings*
~@body))
(defmacro bind-later
[bindings & body]
(let [vars (map (fn [v] `(var ~v)) (take-nth 2 bindings))
values (take-nth 2 (next bindings))]
`(binding [*d
14 matches
Mail list logo