Merge pull request #996 from aiken-lang/acceptance-scenario-108
Illustrate new failing scenario with multi-arg function identifiers
This commit is contained in:
commit
3b94717c58
|
@ -433,11 +433,13 @@ pub fn identify_recursive_static_params(
|
||||||
air_tree: &mut AirTree,
|
air_tree: &mut AirTree,
|
||||||
tree_path: &TreePath,
|
tree_path: &TreePath,
|
||||||
func_params: &[String],
|
func_params: &[String],
|
||||||
func_key: &FunctionAccessKey,
|
func_key: &(FunctionAccessKey, String),
|
||||||
variant: &String,
|
function_calls_and_usage: &mut (usize, usize),
|
||||||
shadowed_parameters: &mut HashMap<String, TreePath>,
|
shadowed_parameters: &mut HashMap<String, TreePath>,
|
||||||
potential_recursive_statics: &mut Vec<String>,
|
potential_recursive_statics: &mut Vec<String>,
|
||||||
) {
|
) {
|
||||||
|
let variant = &func_key.1;
|
||||||
|
let func_key = &func_key.0;
|
||||||
// Find whether any of the potential recursive statics get shadowed (because even if we pass in the same referenced name, it might not be static)
|
// Find whether any of the potential recursive statics get shadowed (because even if we pass in the same referenced name, it might not be static)
|
||||||
for introduced_variable in find_introduced_variables(air_tree) {
|
for introduced_variable in find_introduced_variables(air_tree) {
|
||||||
if potential_recursive_statics.contains(&introduced_variable) {
|
if potential_recursive_statics.contains(&introduced_variable) {
|
||||||
|
@ -474,6 +476,26 @@ pub fn identify_recursive_static_params(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// This is a function call of a recursive function so track that
|
||||||
|
*function_calls_and_usage = (function_calls_and_usage.0 + 1, function_calls_and_usage.1);
|
||||||
|
} else if let AirTree::Var {
|
||||||
|
constructor:
|
||||||
|
ValueConstructor {
|
||||||
|
variant: ValueConstructorVariant::ModuleFn { name, module, .. },
|
||||||
|
..
|
||||||
|
},
|
||||||
|
variant_name,
|
||||||
|
..
|
||||||
|
} = air_tree
|
||||||
|
{
|
||||||
|
if name == &func_key.function_name
|
||||||
|
&& module == &func_key.module_name
|
||||||
|
&& variant == variant_name
|
||||||
|
{
|
||||||
|
// This is a usage of the recursive function either by call or being passed to a function or returned
|
||||||
|
*function_calls_and_usage =
|
||||||
|
(function_calls_and_usage.0, function_calls_and_usage.1 + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,14 +510,15 @@ pub fn modify_self_calls(
|
||||||
// TODO: this would be a lot simpler if each `Var`, `Let`, function argument, etc. had a unique identifier
|
// TODO: this would be a lot simpler if each `Var`, `Let`, function argument, etc. had a unique identifier
|
||||||
// rather than just a name; this would let us track if the Var passed to itself was the same value as the method argument
|
// rather than just a name; this would let us track if the Var passed to itself was the same value as the method argument
|
||||||
let mut shadowed_parameters: HashMap<String, TreePath> = HashMap::new();
|
let mut shadowed_parameters: HashMap<String, TreePath> = HashMap::new();
|
||||||
|
let mut calls_and_var_usage = (0, 0);
|
||||||
body.traverse_tree_with(
|
body.traverse_tree_with(
|
||||||
&mut |air_tree: &mut AirTree, tree_path| {
|
&mut |air_tree: &mut AirTree, tree_path| {
|
||||||
identify_recursive_static_params(
|
identify_recursive_static_params(
|
||||||
air_tree,
|
air_tree,
|
||||||
tree_path,
|
tree_path,
|
||||||
func_params,
|
func_params,
|
||||||
func_key,
|
&(func_key.clone(), variant.clone()),
|
||||||
variant,
|
&mut calls_and_var_usage,
|
||||||
&mut shadowed_parameters,
|
&mut shadowed_parameters,
|
||||||
&mut potential_recursive_statics,
|
&mut potential_recursive_statics,
|
||||||
);
|
);
|
||||||
|
@ -515,7 +538,13 @@ pub fn modify_self_calls(
|
||||||
// Modify any self calls to remove recursive static parameters and append `self` as a parameter for the recursion
|
// Modify any self calls to remove recursive static parameters and append `self` as a parameter for the recursion
|
||||||
body.traverse_tree_with(
|
body.traverse_tree_with(
|
||||||
&mut |air_tree: &mut AirTree, _| {
|
&mut |air_tree: &mut AirTree, _| {
|
||||||
if let AirTree::Call { func, args, .. } = air_tree {
|
if let AirTree::Call {
|
||||||
|
func: func_recursive,
|
||||||
|
args,
|
||||||
|
..
|
||||||
|
} = air_tree
|
||||||
|
{
|
||||||
|
if let AirTree::Call { func, .. } = func_recursive.as_ref() {
|
||||||
if let AirTree::Var {
|
if let AirTree::Var {
|
||||||
constructor:
|
constructor:
|
||||||
ValueConstructor {
|
ValueConstructor {
|
||||||
|
@ -526,9 +555,12 @@ pub fn modify_self_calls(
|
||||||
..
|
..
|
||||||
} = func.as_ref()
|
} = func.as_ref()
|
||||||
{
|
{
|
||||||
|
// The name must match and the recursive function must not be
|
||||||
|
// passed around for this optimization to work.
|
||||||
if name == &func_key.function_name
|
if name == &func_key.function_name
|
||||||
&& module == &func_key.module_name
|
&& module == &func_key.module_name
|
||||||
&& variant == variant_name
|
&& variant == variant_name
|
||||||
|
&& calls_and_var_usage.0 == calls_and_var_usage.1
|
||||||
{
|
{
|
||||||
// Remove any static-recursive-parameters, because they'll be bound statically
|
// Remove any static-recursive-parameters, because they'll be bound statically
|
||||||
// above the recursive part of the function
|
// above the recursive part of the function
|
||||||
|
@ -536,21 +568,49 @@ pub fn modify_self_calls(
|
||||||
for arg in recursive_static_indexes.iter().rev() {
|
for arg in recursive_static_indexes.iter().rev() {
|
||||||
args.remove(*arg);
|
args.remove(*arg);
|
||||||
}
|
}
|
||||||
let mut new_args = vec![func.as_ref().clone()];
|
args.insert(0, func.as_ref().clone());
|
||||||
new_args.append(args);
|
*func_recursive = func.as_ref().clone().into();
|
||||||
*args = new_args;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if let AirTree::Var {
|
||||||
|
constructor:
|
||||||
|
ValueConstructor {
|
||||||
|
variant: ValueConstructorVariant::ModuleFn { name, module, .. },
|
||||||
|
..
|
||||||
|
},
|
||||||
|
variant_name,
|
||||||
|
..
|
||||||
|
} = &air_tree
|
||||||
|
{
|
||||||
|
if name.clone() == func_key.function_name
|
||||||
|
&& module.clone() == func_key.module_name
|
||||||
|
&& variant.clone() == variant_name.clone()
|
||||||
|
{
|
||||||
|
let self_call = AirTree::call(
|
||||||
|
air_tree.clone(),
|
||||||
|
air_tree.return_type(),
|
||||||
|
vec![air_tree.clone()],
|
||||||
|
);
|
||||||
|
|
||||||
|
*air_tree = self_call;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// In the case of equal calls to usage we can reduce the static params
|
||||||
|
if calls_and_var_usage.0 == calls_and_var_usage.1 {
|
||||||
let recursive_nonstatics = func_params
|
let recursive_nonstatics = func_params
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|p| !potential_recursive_statics.contains(p))
|
.filter(|p| !potential_recursive_statics.contains(p))
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
recursive_nonstatics
|
recursive_nonstatics
|
||||||
|
} else {
|
||||||
|
func_params.to_vec()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn modify_cyclic_calls(
|
pub fn modify_cyclic_calls(
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723088177, nanos_since_epoch = 617705000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158432, nanos_since_epoch = 10066000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+650b853"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053744, nanos_since_epoch = 59150000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158433, nanos_since_epoch = 380614000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053741, nanos_since_epoch = 320155000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 363713000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053745, nanos_since_epoch = 634461000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 837171000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053743, nanos_since_epoch = 980113000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 367316000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053741, nanos_since_epoch = 323652000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158436, nanos_since_epoch = 571367000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053745, nanos_since_epoch = 935261000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158436, nanos_since_epoch = 551807000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053746, nanos_since_epoch = 143077000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 941669000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053742, nanos_since_epoch = 886783000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158437, nanos_since_epoch = 43333000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053741, nanos_since_epoch = 320950000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 487166000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053746, nanos_since_epoch = 75454000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 466737000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053742, nanos_since_epoch = 178796000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158432, nanos_since_epoch = 54533000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053745, nanos_since_epoch = 305836000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158437, nanos_since_epoch = 127361000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053743, nanos_since_epoch = 48582000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 59914000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053743, nanos_since_epoch = 766123000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158431, nanos_since_epoch = 785683000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053741, nanos_since_epoch = 684139000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158433, nanos_since_epoch = 377116000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053744, nanos_since_epoch = 433315000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158433, nanos_since_epoch = 339674000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053744, nanos_since_epoch = 904229000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158437, nanos_since_epoch = 77334000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053744, nanos_since_epoch = 446040000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 341686000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053741, nanos_since_epoch = 321730000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158431, nanos_since_epoch = 948979000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053745, nanos_since_epoch = 212209000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158435, nanos_since_epoch = 937845000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053742, nanos_since_epoch = 138704000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158436, nanos_since_epoch = 833716000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053742, nanos_since_epoch = 163400000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158436, nanos_since_epoch = 95704000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -24,5 +24,5 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1723053742, nanos_since_epoch = 375481000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"]
|
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 581622000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053742, nanos_since_epoch = 141032000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158434, nanos_since_epoch = 474753000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053743, nanos_since_epoch = 59195000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158431, nanos_since_epoch = 792706000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -24,5 +24,5 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1723053744, nanos_since_epoch = 103962000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"]
|
"aiken-lang/fuzz@main" = [{ secs_since_epoch = 1723158432, nanos_since_epoch = 675720000 }, "24d601fa19a2002318495bbb8562b9677563ca1b5c03126d6b093a65df076bef"]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053743, nanos_since_epoch = 995320000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158432, nanos_since_epoch = 474723000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -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)
|
||||||
|
}
|
|
@ -13,4 +13,4 @@ requirements = []
|
||||||
source = "github"
|
source = "github"
|
||||||
|
|
||||||
[etags]
|
[etags]
|
||||||
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723053748, nanos_since_epoch = 53624000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1723158439, nanos_since_epoch = 196168000 }, "5e58899446492a704d0927a43299139856bef746e697b55895ba34206fa28452"]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"plutusVersion": "v2",
|
"plutusVersion": "v2",
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"name": "Aiken",
|
"name": "Aiken",
|
||||||
"version": "v1.0.31-alpha+3aa9eb5"
|
"version": "v1.0.31-alpha+6e4a16d"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"validators": [
|
"validators": [
|
||||||
|
|
Loading…
Reference in New Issue