Task

Pass a function     as an argument     to another function.



Related task

   First-class functions


 
#include
"share/atspre_staload.hats"
 
fun app_to_0 (f: (int) -> int): int = f (0)
 
implement
main0 () =
{
//
val () = assertloc (app_to_0(lam(x) => x+1) = 1)
val () = assertloc (app_to_0(lam(x) => 10*(x+1)) = 10)
//
} (* end of [main0] *)
 