In Heresy I did something like the (pipe ...) function above: ; (:> *initial-value* *fn1* ...); The forward pipe operator. Given an initial value and a list of one-argument functions; applys functions in order from left to right and returns the result(def fn :> (initial-value . fns) (for (f in fns with initial-value) (carry (f cry))))
This takes any single argument function just fine, and you can use partial or lambdas for curried functions, but that wasn't enough so I wrote some currying macros, (f> ...) and (l> ...) that expand into single argument lambdas: ; (f> *fn* *args* ...); For currying fns for :>. ; Returns a function that takes initial-value and ; applies it as the first argument of fn(def macro f> (f args ...) (fn (x) (f x args ...))) Now, you might already notice that f> and l> are what Clojure's threading macros do automatically, which is exactly right, and is why you can them write them just like so: ; (-> *value* *fns* ...); The first-argument threading macro. Takes value, and ; threads it in turn as the first argument of the following ; functions(def macro -> (iv (f args ...) ...) (:> iv (f> f args ...) ...)) A similar macro can then be written with l> to create an equivalent to ->>. this, and a simple State monad were recent additions, you can see all the code here: https://github.com/jarcane/heresy/blob/master/lib/monadish.rkt On Sun, Dec 13, 2015 at 3:11 AM, Jack Firth <jackhfi...@gmail.com> wrote: > > This is an area in which there are probably too many options, but > opinions are strong, and we have not standardized (yet). Feedback is > welcome! > > Speaking of which, there's also the `threading` package, which I really > should add the point-free version of ~> to. > > -- > 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. > -- 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.