sophia/test/contracts/deadcode.aes
radrow 18235e5b56 Added standard List library and list comprehensions
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
2019-08-09 13:46:13 +02:00

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.map1((x) => x + 1, xs)