I'm just trying to figure out what the right pattern is
because the fact that I'm forced to make the derived values into
thunks feels really wrong but I honestly don't know what's right in
the context of Clojure.
I don't think you're using the term "thunk" correctly.
A thunk is (usually) a no-argument function, typically used for things
like delayed evaluation, and typically capturing some environment. E.g.,
(defn hello [thunk]
(println "Hello, " (thunk)))
(defn make-name-thunk [name]
(fn [] name))
(let [n (make-name-thunk "Jim")]
(println "Calling hello...")
(hello n))
You are not making your derived values into thunks by this definition.
Your derived values are just that: values, computed by functions.
Compute them when you need them by invoking the appropriate functions
with the appropriate arguments.
Can you explain what you mean by "thunk"?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en