Paul Mooser wrote:
> Good job tracking down that diff -- upon looking at it, unfortunately,
> I obviously don't understand the underlying issue being fixed (the
> inter-binding dependencies) because the "old code" basically matches
> what I would think would be the way to avoid introducing this in an
> outer let form

Lets macro-expand Christophe's example with both the old loop and the 
new loop.

(loop [[x & xs] s
        y xs]
   ...)

So with the old loop we get this:

(loop*
    [G__13702 s
     G__13703 xs]
    (let [[x & xs] G__13702
          y G__13703]
      ...))

See the problem? "xs" is used before it's defined.

The new loop uses the outer-let to get around this:

(let [G__13697 s
       [x & xs] G__13697
       y xs]
   (loop* [G__13697 G__13697
           y y]
          (let [[x & xs] G__13697
                y y]
            ...)))

What initially occurs to me is to move the outer loop into loop*'s vector:

(loop*
    [G__13702 s
     G__13703 (let [[x & xs] G__13702] xs)]
    (let [[x & xs] G__13702
          y G__13703]
      x))

A problem with that is we're going to have to put in a destructuring let 
of all the previous arguments for each loop* argument, so it'll blow up 
in size pretty quickly and  I guess the JVM won't optimize the unused 
bindings away as it can't be sure the (first s) and (rest s) that [[x & 
xs] s] expands into are side-effect free.

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