Add each.

This commit is contained in:
Calvin Rose
2018-05-05 14:41:47 -04:00
parent 256aba199f
commit 238cec8f32
3 changed files with 38 additions and 17 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
(import "examples/iterators.dst")
(defn sum3
"Solve the 3SUM problem O(n^2) time."
"Solve the 3SUM problem in O(n^2) time."
[s]
(def tab @{})
(def solutions @{})
+1 -1
View File
@@ -4,7 +4,7 @@
"Get the number of occurences of each value in a indexed structure."
[ind]
(def freqs @{})
(map (fn [x]
(each (fn [x]
(let [n (get freqs x)]
(put freqs x (if n (+ 1 n) 1)))) ind)
freqs)