fix: headlist builtin on assoc lists

implement chooseunit for 0 args
This commit is contained in:
microproofs
2024-01-13 18:55:39 -05:00
committed by Kasey
parent c7af27a6ba
commit d26524048e
2 changed files with 32 additions and 22 deletions

View File

@@ -1543,7 +1543,14 @@ pub fn special_case_builtin(
mut args: Vec<Term<Name>>,
) -> Term<Name> {
match func {
DefaultFunction::IfThenElse
DefaultFunction::ChooseUnit if count > 0 => {
let term = args.pop().unwrap();
let unit = args.pop().unwrap();
term.lambda("_").apply(unit)
}
DefaultFunction::ChooseUnit
| DefaultFunction::IfThenElse
| DefaultFunction::ChooseList
| DefaultFunction::ChooseData
| DefaultFunction::Trace => {
@@ -1580,16 +1587,6 @@ pub fn special_case_builtin(
term
}
DefaultFunction::ChooseUnit => {
if count == 0 {
unimplemented!("Honestly, why are you doing this?")
} else {
let term = args.pop().unwrap();
let unit = args.pop().unwrap();
term.lambda("_").apply(unit)
}
}
DefaultFunction::UnConstrData => {
let mut term: Term<Name> = (*func).into();