Task

Take a combined set of elements and apply a function to each element.




go => 
   L = 1..10,
 
   % Using map/2 in different ways
   println(L.map(fun)), 
   println(map(L,fun)),   
   println(map(fun,L)),
 
   % List comprehensions
   println([fun(I) : I in L]),
 
   % Using apply/2
   println([apply(fun,I) : I in L]),
 
   % And using list comprehension with the function directly.
   println([I*I : I in L]),
   nl.
 
% Some function
fun(X) = X*X.
 