MCPcopy Create free account
hub / github.com/argumentcomputer/ix / try_reduce_nat_predicate

Method try_reduce_nat_predicate

crates/kernel/src/whnf.rs:2031–2054  ·  view source on GitHub ↗
(
    &mut self,
    addr: &Address,
    args: &[KExpr<M>],
  )

Source from the content-addressed store, hash-verified

2029
2030 let (head, args) = collect_app_spine(wval);
2031
2032 if let Some(result) =
2033 self.try_reduce_fin_val_decidable_rec(id, field, &head, &args)
2034 {
2035 self.dump_proj_trace(id, field, wval, None, Some(&result));
2036 return Ok(Some(result));
2037 }
2038
2039 let ctor_id = match head.data() {
2040 ExprData::Const(id, _, _) => id,
2041 _ => {
2042 self.dump_proj_trace(id, field, wval, None, None);
2043 return Ok(None);
2044 },
2045 };
2046
2047 let ctor_params = match self.try_get_const(ctor_id)? {
2048 Some(KConst::Ctor { params, .. }) => match usize::try_from(params) {
2049 Ok(params) => params,
2050 Err(_) => return Ok(None),
2051 },
2052 _ => {
2053 self.dump_proj_trace(id, field, wval, None, None);
2054 return Ok(None);
2055 },
2056 };
2057

Callers 1

Calls 3

extract_nat_litFunction · 0.85
whnf_nat_reducer_argMethod · 0.80

Tested by

no test coverage detected