I'm using an atom to hold a sorted-map whose keys are integer ids and
values are a particular kind of struct.
I have a function, call it "a", that adds an entry to this map.
It contains just this line:

(swap! my-atom b my-data)

"b" is a function that:
1) determines the next available id by getting the last entry in the
sorted-map and adding 1
2) creates new-struct using my-data
3) creates and returns a new map by calling (assoc current-map id new-struct)

All that seems simple enough.
However, I need to be able to get the new-struct that was just added
so I can pass it to other functions.
In this case, swap! returns the new map that has become the new value
of the atom, not the value that was just added to the map.

I'm looking for a suggestion on how I can get new-struct.

-- 
R. Mark Volkmann
Object Computing, Inc.

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