
Added List library. Flatmaps WIP Fixed dependency in flat_map fcode generation Updated tests to use custom list lib Added comprehension test Added stdlib sanity Test
22 lines
438 B
Plaintext
22 lines
438 B
Plaintext
|
|
namespace MyList =
|
|
|
|
function map1(f : 'a => 'b, xs : list('a)) =
|
|
switch(xs)
|
|
[] => []
|
|
x :: xs => f(x) :: map1(f, xs)
|
|
|
|
function map2(f : 'a => 'b, xs : list('a)) =
|
|
switch(xs)
|
|
[] => []
|
|
x :: xs => f(x) :: map2(f, xs)
|
|
|
|
contract Deadcode =
|
|
|
|
entrypoint inc1(xs : list(int)) : list(int) =
|
|
MyList.map1((x) => x + 1, xs)
|
|
|
|
entrypoint inc2(xs : list(int)) : list(int) =
|
|
MyList.map2((x) => x + 1, xs)
|
|
|