map function

map is a function that takes another function as an argument, along with a collection.

map calls the function provided to it on each member of the collection, then returns a new collection with the results of those function calls.

This may feel a strange concept, but it is at the core of Clojure and functional programming.

(map even? [0 1 2 3 4])

Count the size of words in a collection

Count the number of characters in each word for a collection of strings eg. ["a" "abc" "abcdefg"]

Reveal answer...
(map count ["a" "abc" "abcdefg"])

Functions to try with map

results matching ""

    No results matching ""