> On Oct 8, 2015, at 2:27 PM, Alexis King <lexi.lam...@gmail.com> wrote:
> 
> 
>> On Oct 8, 2015, at 11:08 AM, Alex Knauth <alexan...@knauth.org> wrote:
>> 
>> You don't think
>> (define-simple-macro (-> var:id expr:expr ...+)
>>  (let* ([var expr] ...) var))
>> 
>> Is better?
> 
> No, actually I, I don’t. Threading macros are a convenience, just like 
> anonymous functions. I’d rather keep them simple and easy to use than add 
> another term that needs to be provided 100% of the time that I’ll only take 
> advantage of 5% of the time.

One big thing that I find convenient is the ability to treat everything as an 
expression with sub-expressions. This is convenient because it allows me to 
move expressions around, combine them, and substitute them in whatever ways I 
want, and nothing unexpected happens. My macro and Jack Firth's function both 
allow that. 

> As for compile-time infinite loops: I can’t imagine how that could possibly 
> occur, but if you can demonstrate such a problem, that sounds like a bug.

Your implementation avoids this, and so does the current rackjure 
implementation, but I think at one point the rackjure implementation did this:
'(~>> a b (~>> c d))
'(~>> (~>> a b) (~>> c d))
'(~>> c d (~>> a b))
'(~>> (~> c d) (~>> a b))
'(~>> a b (~> c d)) ; back where we started

This confused me. The rules of recursion made sense, but the expansion didn't 
make sense because the subexpressions weren't subexpressions, but templates.

> As for simpler to keep in your head: [citation needed]. 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.

Introducing binding makes it about expressions that make sense with lexical 
scope, as opposed to templates that stuff will get inserted into. 


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

Reply via email to