> On Oct 8, 2015, at 12:02 AM, Jack Firth <jackhfi...@gmail.com> wrote:
> As for the actual package, I'm a strong proponent of a non-macro version > that's just the reverse of compose, mostly because it plays very nicely with > anonymous macro functions like fancy-app. I'm a bit biased as that's the one > I made in my point-free package however. Macro versions are nice too, but I > prefer the flexibility of an actual function for most purposes. +1 I like the function version better too, as long as I'm also using a good library (such as afl or fancy-app) for concise anonymous functions. But for more complicated expressions, especially involving nesting, what I really want is something like this: (-> x ; declares that x is the equivalent of _ or <> 1 (add1 x) (number->string x 2) (string-append x "1") (string->number x 10)) This is especially helpful when the xs are more deeply nested within the expressions. Which can be defined easily like this: (define-simple-macro (-> var:id expr:expr ...+) (let* ([var expr] ...) var)) The some-> version is almost as simple: (define-simple-macro (some-> var:id expr0:expr expr:expr ...) (let* ([var expr0] [var (and var expr)] ...) var)) I actually got this idea from Matthias Felleisen, from this email on the list: https://groups.google.com/forum/#!msg/racket-users/Um0_anlD8r4/1r-GFejV_HYJ <https://groups.google.com/forum/#!msg/racket-users/Um0_anlD8r4/1r-GFejV_HYJ> Which was rewritten to use let* instead of set! here: https://groups.google.com/forum/#!msg/racket-users/Um0_anlD8r4/cpW0Bp-GMpUJ <https://groups.google.com/forum/#!msg/racket-users/Um0_anlD8r4/cpW0Bp-GMpUJ> I think it would be useful to provide both the function and the macro, without trying to conflate the two. -- 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.