Different applications of reduce in Clojure
I’ve just started learning Clojure using
Clojure for the Brave and True and solving
problems on 4Clojure. While doing so, I’ve noticed
that a lot of problems that seem tricky can be quickly solved using clojure.core/reduce
.
This post is an effort to document some snippets to demonstrate how useful reduce
can be.
Reverse a collection
|
|
Find frequency of words in a string
|
|
Transform all values in a map
|
|
Using reduce to filter out values in map
|
|
Implementing a mapping function
|
|
Sort list of list based on sum of elements
|
|
Generate Fibonacci series
|
|
Finding factorial
|
|
Implementing comp
|
|