Clojure apply vs map

I have a simple explanation which this post is lacking. Let’s imagine an abstract function F and a vector. So,

(apply F [1 2 3 4 5])

translates to

(F 1 2 3 4 5)

which means that F has to be at best case variadic.

While

(map F [1 2 3 4 5])

translates to

[(F 1) (F 2) (F 3) (F 4) (F 5)]

which means that F has to be single-variable, or at least behave this way.

There are some nuances about types, since map actually returns a lazy sequence instead of vector. But for the sake of simplicity, I hope it’s pardonable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)