[racket-users] Standardizing the threading macro and organizing packages

2015-10-07 Thread Alexis King
While in St. Louis, I had a brief conversation with Jay, Alex, and Jack about how we all happen to have our own implementation of Clojure’s threading macro. That macro is called -> in Clojure, but I believe Greg’s rackjure library set the Racket standard of calling it ~>, since the arrow is alre

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-07 Thread Sam Tobin-Hochstadt
A few thoughts: 1. This is a great idea -- one of the reasons that I think Racket has avoided lots of little dialects despite syntactic flexibility is standardizing the community on one thing. I'm glad you're continuing this. 2. When we've standardized on this sort of thing in the core, the prima

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-07 Thread Alexis King
> If this isn't going to be added to the core (and I don't think it should), > then there would need to be some work done on exposure and making sure > everyone who wants this functionality knows "look here first and only roll > your own if this isn't specific enough”. This is a good point, and

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-07 Thread Alex Knauth
To clarify this, I think the function version is better because it's more powerful and more general, not just because it's convenient. A macro constrains you to the syntax, but a function can be used in many different ways. Similarly for the macro, allowing the user to specify the identifier to

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Robby Findler
In addition to agreeing with you and Sam here Alexis, I would like to point out another thing that has worked well for Racket in design situations such as these: benevolent despotism. That is, the person in charge of the design is expected to fully and deeply understand what they have designed and

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Greg Hendershott
Why Rackjure - rackjure is something I started casually, didn't expect it would ever get 100 stars. On the other hand, I suspect nearly all of those stars are "huh, interesting". Not "I actually use this". :) - I have no emotional investment in it. Just feel an obligation to support it for whoeve

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Greg Hendershott
On Thu, Oct 8, 2015 at 10:56 AM, Greg Hendershott wrote: > - If you do want a Clojure style threading _macro_, rackjure's is the > best implementation now AFAIK. I say that with no ego because that's > mostly thanks to help from people like Sam and Christoffer Sawicki. > Among other things, it's c

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alexis King
I decided to release my threading implementation as the “threading” package. The documentation is here: http://pkg-build.racket-lang.org/doc/threading/index.html I’m okay with this because I wanted to pull them out of my utils package, anyway, and they’re nice to have, even if we come up with a

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
You don't think (define-simple-macro (-> var:id expr:expr ...+) (let* ([var expr] ...) var)) Is better? It's more powerful, because it allows placeholders to be arbitrarily nested within the expressions. Also, it allows the user to supply their own identifier to use as a placeholder instead o

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alexis King
> On Oct 8, 2015, at 11:08 AM, Alex Knauth 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 e

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 2:27 PM, Alexis King wrote: > > >> On Oct 8, 2015, at 11:08 AM, Alex Knauth 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,

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 2:27 PM, Alexis King 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 ~> expressio

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alexis King
> My macro and Jack Firth's function both allow that. Sounds like the solution is to go with a function instead of a macro then. If you want that flexibility, I don’t think there’s any reason to stick with a macro, anyway. The point-free package is very nice. Alexis -- You received this mess

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Jack Firth
I agree about using the function form for flexibility. (Alliteration!) The macro form should be optimized for simple cases, because macros by nature are less flexible. If you have a complex case, write actual functions. You'll spend less time wrangling the syntax system that way. On Thu, Oct 8, 20

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Jay McCarthy
FWIW, I find my threading macro to be very powerful, pretty clear when used complicatingly, and at about power-level 9,000: https://github.com/jeapostrophe/exp/blob/master/threading-arrow.rkt My opinion is to include something like this in remix along with some nice syntax for cut (what ignorant

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 4:48 PM, Jay McCarthy wrote: > A key thing that Remix has is buttery C-like syntax for infix dots. So > you can write r.ul.x and it might be the same as (posn-x (rectangle-ul > r)) if `r` were bound to a "dot transformer" that looked for .ul and > so on. (Off topic) Sounds

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Greg Hendershott
> Quick! Should (~>> (~>> a b) (~>> c d)) be equal to (~>> (b a) (~>> c d)) ? Well, I wouldn't want to write or read code like that. If I'm using a threading macro, at all, it's to reduce nesting, and emphasize the "flat", "pipeline" quality of some computations. As a result I'm not eager to write

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alex Knauth
> On Oct 8, 2015, at 4:51 PM, Jack Firth wrote: > > Looking at that one, I'm against back-referencing N clauses with (<> n). I > find it very difficult to read, and it strikes me as particularly fragile if > you're inserting or removing steps into the flow as you edit it. > Trying to count b

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Alexis King
> On Oct 8, 2015, at 1:34 PM, Jay McCarthy wrote: > > FWIW, I find my threading macro to be very powerful, pretty clear when > used complicatingly, and at about power-level 9,000: > > https://github.com/jeapostrophe/exp/blob/master/threading-arrow.rkt I have to agree with Jack and Alex here: I

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Jay McCarthy
On Thu, Oct 8, 2015 at 6:23 PM, Alexis King wrote: >> On Oct 8, 2015, at 1:34 PM, Jay McCarthy wrote: >> >> FWIW, I find my threading macro to be very powerful, pretty clear when >> used complicatingly, and at about power-level 9,000: >> >> https://github.com/jeapostrophe/exp/blob/master/threadin

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Sam Tobin-Hochstadt
On Thu, Oct 8, 2015 at 6:48 PM, Jay McCarthy wrote: > >>> My opinion is to include something like this in remix along with some >>> nice syntax for cut (what ignorant people call "function literals".) >> >> I admit I can’t really disagree with this point. I’m mostly just interested >> in what syn

Re: [racket-users] Standardizing the threading macro and organizing packages

2015-10-08 Thread Jack Firth
The more I think about it, the more I realize I really dislike specifying the position of arguments in these anonymous function syntaxes. For instance I would prefer this: (λ (x y) (/ y x)) To this: λ.(/ $.1 $.0) In the common case, you won't need to flip any argument orders around. In that cas

Re: [racket-users] Standardizing the threading macro and organizing packages

2016-01-29 Thread Brian Adkins
On Wednesday, October 7, 2015 at 11:18:41 PM UTC-4, Sam Tobin-Hochstadt wrote: > A few thoughts: > > 1. This is a great idea -- one of the reasons that I think Racket has > avoided lots of little dialects despite syntactic flexibility is > standardizing the community on one thing. I'm glad you're

Re: [racket-users] Standardizing the threading macro and organizing packages

2016-01-31 Thread Alexis King
> On Jan 29, 2016, at 21:55, Brian Adkins wrote: > > Was any consensus reached on this? I've been working through some exercises > in Racket that a friend is implementing in Elixir, and I just came across a > "method chaining" situation. I ended up simply writing a wrapper function, > but usin

Re: [racket-users] Standardizing the threading macro and organizing packages

2016-02-12 Thread Brian Adkins
On Sunday, January 31, 2016 at 1:05:17 PM UTC-5, Alexis King wrote: > > On Jan 29, 2016, at 21:55, Brian Adkins wrote: > > > > Was any consensus reached on this? I've been working through some exercises > > in Racket that a friend is implementing in Elixir, and I just came across a > > "method c