Last active
August 29, 2015 14:06
-
-
Save ship561/616809eea6293f915b86 to your computer and use it in GitHub Desktop.
Example of reducers/fold hanging when the input is a hashmap
This file contains hidden or 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
(let [sqs {"AUGUGGAAAG" 4, "CGACCUCGUC" 2, "CCAGCGAACC" 2, "GGGCGAAGCU" 5, "GUUUACUUCA" 1, | |
"UACCAUAGUA" 1, "CGACCAGCAU" 2, "UGAAUUUCGA" 2, "GGUCUUUCUU" 2, "UGAAAUACAU" 1}] | |
(prn :>>) | |
(r/fold (fn ([] {}) | |
([l r] (merge-with + l r))) | |
(fn [M sq cs] | |
(->> (take 2 sq) | |
frequencies | |
(merge-with + M))) | |
sqs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment