Add placeholders for new terms in optimize
Update tests to check optimization is applied properly
Update tests to check optimization is applied properly
Term::equals_integer()
.apply(
Term::un_i_data().apply(
Term::head_list()
.apply(Term::var("__fields"))
.lambda("__fields")
.apply(
Term::var(CONSTR_FIELDS_EXPOSER).apply(Term::var("a")),
),
Term::head_list().apply(
Term::var(CONSTR_FIELDS_EXPOSER).apply(Term::var("a")),
),
),
)
.apply(Term::var("x"))
.apply(Term::var("mb_b_index"))
.delayed_if_else(
Term::equals_data()
.apply(
Term::head_list()
.apply(Term::var("__fields"))
.lambda("__fields")
.apply(
Term::var(CONSTR_FIELDS_EXPOSER)
.apply(Term::var("o")),
),
)
.apply(Term::head_list().apply(
Term::var(CONSTR_FIELDS_EXPOSER).apply(Term::var("o")),
))
.apply(Term::var("addr1"))
.delayed_if_else(
Term::constr_data().apply(Term::integer(0.into())).apply(
.lambda("tuple_item_0")
.apply(Term::head_list().apply(Term::var("val")))
.lambda("val")
.apply(
Term::unmap_data().apply(
Term::head_list()
.apply(Term::tail_list().apply(Term::var("__fields")))
.lambda("__fields")
.apply(Term::var(CONSTR_FIELDS_EXPOSER).apply(Term::var("dat"))),
),
)
.apply(Term::unmap_data().apply(Term::head_list().apply(
Term::tail_list().apply(Term::var(CONSTR_FIELDS_EXPOSER).apply(Term::var("dat"))),
)))
.lambda("dat")
.apply(Term::Constant(
Constant::Data(Data::constr(
let arg = Rc::make_mut(argument);
builtin_force_reduce(arg, builtin_map);
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
let arg = Rc::make_mut(argument);
force_delay_reduce(arg);
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
let f = Rc::make_mut(f);
inline_direct_reduce(f);
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
let f = Rc::make_mut(f);
inline_identity_reduce(f);
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
let f = Rc::make_mut(f);
inline_basic_reduce(f);
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
Term::Force(f) => {
wrap_data_reduce(Rc::make_mut(f));
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
+ var_occurrences(argument.as_ref(), search_for)
}
Term::Force(x) => var_occurrences(x.as_ref(), search_for),
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => 0,
}
}
delayed_execution(function.as_ref()) + delayed_execution(argument.as_ref())
}
Term::Force(x) => delayed_execution(x.as_ref()),
Term::Case { constr, branches } => {
1 + delayed_execution(constr.as_ref())
+ branches
.iter()
.fold(0, |acc, branch| acc + delayed_execution(branch))
}
Term::Constr { fields, .. } => fields
.iter()
.fold(0, |acc, field| acc + delayed_execution(field)),
_ => 0,
}
}
let f = Rc::make_mut(f);
lambda_reduce(f);
}
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
_ => {}
}
}
argument: Rc::new(substitute_term(argument.as_ref(), original, replace_with)),
},
Term::Force(x) => Term::Force(Rc::new(substitute_term(x.as_ref(), original, replace_with))),
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
x => x.clone(),
}
}
}
}
Term::Force(x) => Term::Force(Rc::new(replace_identity_usage(x.as_ref(), original))),
Term::Case { .. } => todo!(),
Term::Constr { .. } => todo!(),
x => x.clone(),
}
}
Alonzo builds