Hello Folks,
I'm a noob to both programming (1 year part-time) and to Clojure (1
week).
I am unclear on how I can call an Ifn stored in a map usefully....
and I am hoping you can help me.
I have stored data in a few maps (both functions and data):
user=> (def uhoh* (ref {:event {:date #(date) :name "EOW"}}))
#'user/uhoh*
user=> (def why* (ref {:event {:stuff "ELI"}}))
#'user/why*
I call the key having a string:
user=> ((uhoh* :event) :name)
"EOW"
sweet!
I call the key having an Ifn:
user=> ((uhoh* :event) :date)
#<user$fn__2476 user$fn__2...@273f212a>
hmmmmm..... not what I wanted!
let's try this another way:
user=> (((uhoh* :event) :date))
Tue 22 Jun 2010 17:41:23 MDT
nil
sweet!
let's pull my maps together:
user=>(def current* (merge (uhoh* :event)(why* :event)))
#'user/current*
here's my problem:
user=> current*
{:stuff "ELI", :date #<user$fn__2507
user$fn__2...@4fa3551c>, :name "EOW"}
I was hoping this kind of a call would yield:
{:stuff "ELI", :date "Tue 22 Jun 2010 17:45:32 MDT", :name
"EOW"}
I need the date representing the time I assign the def (evaluated at
call time) and I don't know which keys will have an Ifn or just a
string etc.
Is there existing falicilites to make this happen? An existing
function call perhaps not obvious to me? Or do I need to write custom
loops to cycle through and handle each item?
Thanks,
Tim
--
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