by camdez · 2y ago · 0 comments
(frequencies (map second v))
;; => {"one" 2, "two" 2, "three" 1, "four" 1}
;; or:
(update-vals (group-by second v) count)
;; => {"one" 2, "two" 2, "three" 1, "four" 1}
;; +(#:'=v[;1];?v[;1])
;; flip(count each group v[;1];unique v[;1])
So, shorter than the readable K version in a Lisp.What did we learn here? Probably nothing.
K is great for sequence operations--not sure what we're trying to imply about Lisps.
No comments yet.