This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn frequencies-by | |
"Returns a map from distinct results of (f item) in coll | |
to a vector duple of all (k item) (if k is provided, or items otherwise) | |
with the same (f item) value, and the number of times (f item) appears. | |
" | |
([f coll] | |
(frequencies-by f nil coll)) | |
([f k coll] | |
(persistent! ;; copied from clojure.core |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See | |
https://gist.github.com/ericnormand/7174aaccc71025de86ddac77553f8595 | |
How many digits? | |
Imagine you took all the integers between n and m (exclusive, n < | |
m) and concatenated them together. How many digits would you have? | |
Write a function that takes two numbers and returns how many | |
digits. Note that the numbers can get very big, so it is not | |
possible to build the string in the general case. |
OlderNewer