mirror of
https://github.com/janet-lang/janet
synced 2026-09-15 22:01:21 +00:00
Add each.
This commit is contained in:
+1
-1
@@ -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 @{})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user