0
(def tables [{:table "A" :occupied false :party nil} {:table "B" :occupied false :party nil} {:table "C" :occupied false :party nil}]) 

1) How do I make a change to a single map with a vector?

ex. set :occupied = true where :table= "C"

2) What about updating all map values? ex. set :occupied = false for all maps

1 Answer 1

1

(map (fn [t] (if (= (:table t) "C") (assoc t :occupied true) t)) tables)

(map #(assoc % :occupied false) tables)

Note that these will not change your tables, because they are immutable data structures, this code will instead return a new sequence of tables with the differences you describe.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.