I am trying to use a hash-map within closure as i have a for loop that passes in a sorted string and an un-sorted string to my function, what i want to do is two if statements on the hash-map
1st if statement is
if hash-map doesnt contain string "x"
put x in a new hash-set
2nd if statement is
if hash-map key "x" value is not equal to "y"
remove "x" from hash-set
This is what i have so far
(defn transform3 [y]
(let [x (sort-string (str/lower-case y))
my-hash-map (hash-map)
hashmap2 (hash-map)]
(if-not (contains? my-hash-map x)
(my-hash-map x, y)
(hashmap2 y))
(if-not (get hash-map x) y)
(dissoc hashmap2 x)
;;remove from hash-set to do...
))
How would i do if statement that would allow me to use things like "get" "contains" "put" etc...??
assocanddissoc. Alsoconj. And then difference between sets and maps. Quite possibly you should be using a set in your question.