Perform an operation on every item of a list, e.g.
for the list
["ox", "cat", "deer", "whale"] calculate
the list of sizes of the strings, e.g.
[2, 3, 4, 5]
fsharp 1.9.9.9let lengths = List.map String.length ["ox"; "cat"; "deer"; "whale"]
let lengths = List.map String.length ["ox"; "cat"; "deer"; "whale"]
clojure (map count ["ox" "cat" "deer" "whale"])
(map count ["ox" "cat" "deer" "whale"])
Submit a new solution for
fsharp or
clojure
There are 15 other solutions in
additional languages (
cpp,
csharp,
erlang,
fantom ...)