kyleect / locks

A toy language branched from Lox to learn language implementation and tooling. Forked from loxcraft
https://kyleect.github.io/locks/#/docs
MIT License
0 stars 0 forks source link

Auto Curry Functions #15

Open kyleect opened 11 months ago

kyleect commented 11 months ago
fun sum(a, b) {
  return a + b;
}

var sum5 = sum(5);

print sum5(10); // out: 15

Typed

// Function<[Int, Int], Int>
// (Int, Int) => Int
fun sum(a: Int, b: Int): Int {
  return a + b;
}

var sum5: Function<[Int], Int> = sum(5);
var sum5b: (Int) => Int = sum(5);

print sum5(10); // out: 15