Illustrate new failing scenario with multi-arg function identifiers
As far as I could tell, this behavior is only observed when the arity of the function is higher than 1. It's fine for single-arg functions somehow.
This commit is contained in:
parent
59bc9e04ad
commit
6e4a16d8e0
|
@ -0,0 +1,7 @@
|
|||
# This file was generated by Aiken
|
||||
# You typically do not need to edit this file
|
||||
|
||||
requirements = []
|
||||
packages = []
|
||||
|
||||
[etags]
|
|
@ -0,0 +1,9 @@
|
|||
name = "aiken-lang/108"
|
||||
version = "0.0.0"
|
||||
license = "Apache-2.0"
|
||||
description = "Aiken contracts for project 'aiken-lang/108'"
|
||||
|
||||
[repository]
|
||||
user = "aiken-lang"
|
||||
project = "108"
|
||||
platform = "github"
|
|
@ -0,0 +1,44 @@
|
|||
use aiken/builtin
|
||||
|
||||
pub fn reduce(xs: List<a>, zero: b, do: fn(a, b) -> b) -> b {
|
||||
when xs is {
|
||||
[] -> zero
|
||||
[head, ..tail] -> do(head, reduce(tail, zero, do))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn inspect_1(self: Data, result: result) -> result {
|
||||
builtin.choose_data(
|
||||
self,
|
||||
fail,
|
||||
fail,
|
||||
reduce(builtin.un_list_data(self), result, fn(a, b) { inspect_1(a, b) }),
|
||||
{
|
||||
trace @"int"
|
||||
result
|
||||
},
|
||||
fail,
|
||||
)
|
||||
}
|
||||
|
||||
test as_lambda() {
|
||||
inspect_1([14, 42], True)
|
||||
}
|
||||
|
||||
pub fn inspect_2(self: Data, result: result) -> result {
|
||||
builtin.choose_data(
|
||||
self,
|
||||
fail,
|
||||
fail,
|
||||
reduce(builtin.un_list_data(self), result, inspect_2),
|
||||
{
|
||||
trace @"int"
|
||||
result
|
||||
},
|
||||
fail,
|
||||
)
|
||||
}
|
||||
|
||||
test as_identifier() {
|
||||
inspect_2([14, 42], True)
|
||||
}
|
Loading…
Reference in New Issue