> On Oct 8, 2015, at 2:27 PM, Alexis King <lexi.lam...@gmail.com> wrote: > > The original threading macro is a simple macro that unwinds nested function > application. Implementation aside, I find that the most intuitive way to > visualize it—introducing binding makes that more complicated, not less.
An ~> expression has a start expression followed by a series of templates. But at least the start expression is an expression, so it should be able to be replaced with what it equals. Quick! Should (~>> (~>> a b) (~>> c d)) be equal to (~>> (b a) (~>> c d)) ? Uh, wait, ahh! My intuition says yes ? Nope. One expands to (d c (b a)), and the other expands to (b a (d c)). Quick! Can you tell which one expands to which? I can't unless I actually evaluate expand-once a bunch of times. If I were implementing this, I would make sure that (~>> some-expr some-template ...) was always equal to (let ([x some-expr]) (~>> x some-template ...)) I'm pretty sure there's some technical term for being able to do this, but I can't think of it. Apply that rule recursively to all the intermediate steps, and (let* ([x some-expr] [x (subst x some-template)] ...) x) -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.