Lesser known Clojure: max-key and min-key

Some time ago Bozhidar Batsov wrote such a tweet:

Read more

Lesser known Clojure: reduce kv

In addition to commonly known reduce function Clojure has its specialized version called reduce-kv. This function is designed to work with associative collections (like map or vector). Here is its signature:

Read more

Lesser known Clojure: keep, keep-indexed and map-indexed functions

I could safely say that map, reduce and filter are the most commonly used functions in Clojure (and probably other functional languages). Of course Clojure provides other useful functions that operate on collections that are not so popular and commonly known. Let’s look at some of them.

Read more

Lesser known Clojure every-pred and some-fn functions

The common thing in functional programming is combining “smaller” functions into the bigger one (higher-order functions). The examples of such functions are every-pred and some-fn. Both those functions were added to Clojure in release 1.3.

Read more

Lesser known Clojure: variants of threading macro

The threading macros (-> and ->>) provide easy to understand and read mechanism of sequential transformation of data in Clojure. I’m pretty sure that you know it, but for the sake of clarity I start this post with a recap.

Read more