Hi,
Am 21.02.2012 um 22:35 schrieb Aaron Cohen:
> I'd actuallly tried to avoid littering the syntax tree with :constants
> elements anywhere other than where they were needed, but thinking
> about it, there doesn't really seem to be any reason to do that, and
> it does make the implementation much simpler.
I thought of it as each form carrying the interesting information about eg. the
contained constants with itself. I understand your idea of keeping things
clean. But then there is meta data and maybe this is a very valid use of it. In
fact this information *is* metadata about the form.
>> (defn processor
>> [pre-fns post-fns]
>> (fn this [form]
>> (let [form (reduce call form pre-fns)
>> form (maybe recursive? update-children form this)]
>> (reduce call form post-fns))))
>
> This is really neat, setting up the processor up front with the
> processing functions will work much better than my current overloading
> scheme. It's also cool how this provides for a list of pre and post
> fns. I'd initially tried to do this but backed off from it as
> over-complicated.
Of course this version features a cunning inlineing of comp to achieve stunning
performance characteristics. *coughcough*
Things should probably be more like this:
(defn processor
[pre-fns post-fns]
(let [pre (apply comp pre-fns)
post (apply comp post-fns)]
(fn this [form]
(let [form (pre form)
form (maybe recursive? update-children form this)]
(post form)))))
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en