Last active
December 29, 2015 23:49
-
-
Save frankhale/7745450 to your computer and use it in GitHub Desktop.
Playing with maps in Clojure
This file contains hidden or 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
; Playing here, trying to figure out how to work with vectors of maps, my brain synapses are connecting but | |
; this code doesn't totally reflect the connections made. This will be rectified within 24 hours! HAHA! | |
;(def buffers (atom [])) | |
;(swap! buffers conj {:file-name "one.txt" :file-text "first file"} | |
; {:file-name "two.txt" :file-text "second file"} | |
; {:file-name "three.txt" :file-text "third file"} | |
; {:file-name "four.txt" :file-text "fourth file"}) | |
;@buffers | |
;(swap! buffers conj {:file-name "text.txt" :file-text "this is a test"}) | |
;(map #(if-not (= (:file-name %) "three.txt") %) @buffers) | |
(def editor-state (atom {:buffers []})) | |
(swap! editor-state assoc :buffers (conj (:buffers @editor-state) {:file-name "foo.txt" :file-text "hello, world!"})) | |
@editor-state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment