aiken/examples/acceptance_tests/038/lib/tests.ak

22 lines
304 B
Plaintext

pub fn and_f(self: List<Bool>) -> Bool {
when self is {
[] -> True
[x, ..xs] -> x && and_f(xs)
}
}
test and_f_1() {
and_f([True, True])
}
pub fn or_f(self: List<Bool>) -> Bool {
when self is {
[] -> False
[x, ..xs] -> x || or_f(xs)
}
}
test or_f_1() {
or_f([True, True])
}