mirror of
https://github.com/janet-lang/janet
synced 2026-10-19 05:52:27 +00:00
Simplify frequencies implementation (#1793)
* Add tests for frequencies * Simplify frequencies implementation --------- Co-authored-by: sogaiu <983021772@users.noreply.github.com>
This commit is contained in:
+1
-2
@@ -1764,8 +1764,7 @@
|
||||
[ind]
|
||||
(def freqs @{})
|
||||
(each x ind
|
||||
(def n (in freqs x))
|
||||
(set (freqs x) (if n (+ 1 n) 1)))
|
||||
(put freqs x (inc (in freqs x 0))))
|
||||
freqs)
|
||||
|
||||
(defn group-by
|
||||
|
||||
Reference in New Issue
Block a user