Taken from Lecture 2
math
module contains a sqrt
function, but
can’t pass it as an argument. Module functions aren’t higher-order function.
Instead, we can wrap it with a fun
:
1> lists:map(fun math:sqrt/1, [9, 16, 25]).
[3.00000,4.00000,5.00000]