What do you mean by this? Something like the following?
arc> (-> 1 2 /) 2
(mac -> (x . rest) (if (no rest) x (let (expr . more) rest (if more `(-> (-> ,x ,expr) ,@more) (acons expr) `(,(car expr) ,x ,@(cdr expr)) (list expr x)))))
arc> (macex '(-> 1 2 (fn (x y) (/ x y)))) (fn (-> 1 2) (x y) (/ x y))
I like the simplicity of something like this:
(mac -> exprs (reduce (fn (l r) (list r l)) exprs))
Maybe this?
(def -> exprs (reduce (fn (l r) (let ls (check l alist (list l)) (if (~isa r 'fn) ; but what about callable objs? (cons r ls) (apply r ls)))) exprs)) arc> (def flip (f) (fn (y x) (f x y))) #<procedure: flip> arc> (-> 1 2 + [fn (x) (+ x _)] '(1 2 3) (flip map)) (4 5 6)
Here's the current varargs version of -> in wart:
mac (transform x ... fs|thru) if no.fs x `(transform (,x -> ,car.fs) ,@cdr.fs)
(transform 3 :thru (fn(_) (_ * 2)) (fn(_) (_ + 1)))
(transform 1 2 :thru (fn(a b) (a * b)) (fn(_) (_ + 1)))
(transform 1*2 :thru (fn(_) (_ + 1)))
-----
I love how I could switch programming models for the one line in this example where it made sense: http://rosettacode.org/wiki/Rot-13#Wart