Task

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




class MAIN is
  do_something(i:INT):INT is
    return i * i;
  end;
 
  main is
    a:ARRAY{INT} := |1, 2, 3, 4, 5|;
    -- we use an anonymous closure to apply our do_something "callback"
    a.map(bind(do_something(_)));
    loop #OUT + a.elt! + "\n"; end;
  end;
end;