Hi,

one could use lazymap: https://bitbucket.org/kotarak/lazymap. Unfortunately, 
it is broken at the moment. Have to bring up-to-date with 1.2 and later.

(defn person
  [name year-of-birth]
  (lazy-hash-map :name name :age (- 2011 year-of-birth)))

The actual difference would only be calculated when the :age key is 
accessed. The result would then be cached. (It uses delays under the hood).

Sincerely
Meikel

-- 
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

Reply via email to