Task

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




© For no return value
Define foreach(fe_cname,fe_list) = Prgm
  Local fe_i
  For fe_i,1,dim(fe_list)
    #fe_cname(fe_list[fe_i])
  EndFor
EndPrgm
 
© For a list of results
Define map(map_cnam,map_list) = seq(#map_cnam(map_list[map_i]),map_i,1,dim(map_list))
 
Define callback(elem) = Prgm
  Disp elem
EndPrgm
 
foreach("callback", {1,2,3,4,5})
Disp map("√", {1,2,3,4,5})