sophia/test/contracts/patterns_guards.aes
2021-10-19 11:04:25 +03:00

15 lines
253 B
Plaintext

include "List.aes"
contract C =
type state = int
entrypoint init() = f([1, 2, 3, 4])
function
f(x::[]) = 1
f(x::y::[]) = 2
f(x::y::z) = switch(z)
[] => 4
a::[] | a > 10 => 5
b | List.length(b) > 5 => 6
c => 7