(defn a-step-transducer
[]
(fn [reducing-fn]
(fn
([] (reducing-fn))
([result] (reducing-fn result))
([[guid-state processed-events :as result] event]
;; step-specific logic
))))(defmacro deftransducer
[body]
`(fn [reducing-fn]
(fn
([] (reducing-fn))
([result] (reducing-fn result))
([[guid-state processed-events :as result] event]
~@body))))storm-etl.entry-processing> (deftransducer "something")
CompilerException java.lang.RuntimeException: Can't use qualified name as parameter: storm-etl.entry-processing/reducing-function--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
My $0.02 is only resort to macros when all else has failed. Can just higher order functions and composition and injection get you closer to what you want?
June 10, 2016 at 1:06 PM via Postbox
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
clojure.core/completing
([f] [f cf])
Takes a reducing function f of 2 args and returns a fn suitable for
transduce by adding an arity-1 signature that calls cf (default -
identity) on the result argument.
I think you can do what you want with existing transducers. Won't map/filter/keep/etc do the trick?
My $0.02 is only resort to macros when all else has failed. Can just higher order functions and composition and injection get you closer to what you want?
You can "capture" symbols from the surrounding context, making them available to the body of your macros, the "tilde tick trick" is what you're looking for there
But maybe the core function completing is very close to what you're looking for...
A higher-order function can do what this macro does: https://gist.github.com/favila/ecdd031e22426b93a78f
(defn transducing
[f]
(fn [reducing-fn]
(fn
([] (reducing-fn))
([result] (reducing-fn result))
([result input] (f result input reducing-fn)))))--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/-XIekEB6zu0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.