Cheddar icon indicating copy to clipboard operation
Cheddar copied to clipboard

Feature request: Functional operators

Open ConorOBrien-Foxx opened this issue 7 years ago • 8 comments

There should be an operator that curries a function. Perhaps ~:?

let add = ~: (x, y, z) -> x + y * z;
print(add(3)(4)(5));    // 23

A memoizing function/operator. E.g.:

let fib = memo(n -> n < 2 ? n : fib(n - 1) + fib(n - 2))
fib(1000); // takes however long
fib(1000); // takes virtually no time

Dynamic programing FTW!


I wonder if any more should be considered.

ConorOBrien-Foxx avatar Oct 05 '16 02:10 ConorOBrien-Foxx