Created
February 14, 2011 17:21
-
-
Save Chouser/826197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn stamped [vctr f & args] | |
(conj vctr (apply f (assoc (peek vctr) :stamp (java.util.Date.)) args))) | |
user=> (def v (atom [])) | |
#<Var@3af7345b: #<Atom@61128f5a: []>> | |
----- | |
user=> (swap! v stamped assoc :name "Joe") | |
[{:name "Joe", :stamp #<Date Mon Feb 14 12:19:23 EST 2011>}] | |
----- | |
user=> (swap! v stamped assoc :name "Bob") | |
[{:name "Joe", :stamp #<Date Mon Feb 14 12:19:23 EST 2011>} | |
{:name "Bob", :stamp #<Date Mon Feb 14 12:19:28 EST 2011>}] | |
----- | |
user=> (swap! v stamped assoc :last_name "Smith") | |
[{:name "Joe", :stamp #<Date Mon Feb 14 12:19:23 EST 2011>} | |
{:name "Bob", :stamp #<Date Mon Feb 14 12:19:28 EST 2011>} | |
{:last_name "Smith", | |
:name "Bob", | |
:stamp #<Date Mon Feb 14 12:19:41 EST 2011>}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment