Define the stream transformer name by body.
The non-stream arguments args and the stream arguments streams
are given separately, with args being possibly empty.
(defmacro defst
"Define the stream transformer name by body.
The non-stream arguments args and the stream arguments streams
are given separately, with args being possibly empty."
[name args streams & body]
(if (= (first streams) '&)
`(defn ~name ~(vec (concat args streams))
(let [~'st (with-monad stream-m ~@body)]
(st-as-stream ~'st ~(second streams))))
`(defn ~name ~(vec (concat args streams))
(let [~'st (with-monad stream-m
(let [~streams (range ~(count streams))]
~@body))]
(st-as-stream ~'st ~streams)))))
Comments top
No comments for defst. Log in to add a comment.