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 case the numbering is just noise that gets tuned down relative to the expression structure. In the uncommon case, because of the common case I might not notice it when reading the code and could critically misread the order of an anonymous function's arguments. In addition, when shuffling the positions around I find it much easier to think in terms of actual bindings, as with the first example, than in terms of positions, as in the second example. What if I need to change argument order or insert an argument? Now I have to tweak the numbers used in the *structure* of the function, rather than just messing with the declaration of bindings for the function. This is why I like fancy-app. Once you throw out specifying positions, you don't need that syntactic overhead in the common cases. You're left with just structure: (define halve (/ _ 2)) Ideally fancy app would do keyword arguments and rest arguments, perhaps rest arguments as (+ . _). I think it handles keyword args (never tried) but I don't know if it does rest args. On Thu, Oct 8, 2015 at 3:48 PM, Jay McCarthy <jay.mccar...@gmail.com> wrote: > On Thu, Oct 8, 2015 at 6:23 PM, Alexis King <lexi.lam...@gmail.com> wrote: > >> On Oct 8, 2015, at 1:34 PM, Jay McCarthy <jay.mccar...@gmail.com> > 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 find that a little > terrifying, and I would not want to need to understand any code that used > it. > > I'm inspired by your terror. > > >> 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 syntax you have in mind. > > The idea would be to make it like super cut, but with . to give it > that delicious C-like crunchy topping > > https://github.com/jeapostrophe/exp/blob/master/scut.ss > > So, > > λ.(+ $ 1) => (λ (x) (+ x 1) > λ.(+ $.0 $.1) => (λ (x y) (+ x y)) > λ.(+ $.x 1) => (λ (#:x x) (+ x 1) > λ.(+ $.x $8) => (λ (#:x x a0 a1 a2 a3 a4 a5 a6 a7 a8) (+ x a8) > λ.(apply + $.0 $.…) => (λ (x . args) (apply + x args)) > > -- > Jay McCarthy > http://jeapostrophe.github.io > > "Wherefore, be not weary in well-doing, > for ye are laying the foundation of a great work. > And out of small things proceedeth that which is great." > - D&C 64:33 > -- 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.