When defining a map literal, is it possible to reference the map that is 
being defined?

I have some code that looks like this:

    (let [radius 20
          diameter (* 2 radius)
          circumference (* pi diameter)]
      {:radius radius
       :diameter diameter
       :circumference circumference})

I would like to simplify it to something like:

    {:radius 20
     :diameter (* 2 (% :radius))
     :circumference (* pi (% :diameter))}

where % is the map itself.

Is this possible with the {}-syntax, or is there a macro to do this in 
the standard library or contrib?

--
Timo

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