Higher Order functions

Function as parameters

fun map[A, B](Array[A] input, (A) -> (B) function) -> Array[B] {
  // implementation
}thp

Function as return

fun generate_generator() -> () -> Int {
  // code...
  return fun() {
      322
  }
}

val generator = generate_generator() // A function
val value = generate_generator()() // An Intthp