736 B
736 B
Functions
TODO: Scala syntax? Haskell syntax? Implications? How do we specify names for parameters? Do we want to do that? How do function arguments, tuples, and records all relate to one another? Are they all just the same? How do we talk about curried functions? Is that supported? Is there some other mechanism?
TODO: This is all 100% up in the air right now.
fn example: () => Int32 is 42
example
example()
fn example: String => Int32 is str => length(str)
example "foo"
example("foo")
fn example: { x: Int32, y: Int32 } => Int32 is (x, y) => x + y
example 1 2
example(1, 2)
example { x: 1, y: 2 }
fn map[F[*], A, B]: (F[A]) => (A => B) => F[B] is
(fa) (f) => fa f
map(list)(x => x + 1)