Hello, 

I have recently come a cross a number of references to Clojure's threading 
macros, -> and ->>. These macros have the form: ((or -> ->>) x form ...). The 
value of x is spliced in as the first or last argument, respectively, of form 
with its result being likewise spliced into the next form and so on. From the 
examples I have seen, these macros can be useful, but instead of replicating 
these macros exactly in bigloo, I decided to create a generalized version 
called T> where _ is used to indicate where values are to be spliced in. T> has 
the form: (T> x form1 ...) In form1 and subsequent forms the _ character is 
used to indicate where x should be spliced.

Examples:

(T> 4 (+ _ 3) (* 3 _)) => 21


(T> '( 1 2 3 4) 
(map odd? _) 
(map (lambda (x) (* x 2)) _))  => (2 6)


The definition of T> is attached. I would be interested in any comments or 
suggestions you may have.

Thanks,
Joseph Donaldson

Attachment: threading.sch
Description: Binary data

Reply via email to