Skip to content

Instantly share code, notes, and snippets.

@ship561
Last active August 29, 2015 14:06
Show Gist options
  • Save ship561/616809eea6293f915b86 to your computer and use it in GitHub Desktop.
Save ship561/616809eea6293f915b86 to your computer and use it in GitHub Desktop.
Example of reducers/fold hanging when the input is a hashmap
(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