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

Method nat_offset

crates/kernel/src/whnf.rs:1149–1178  ·  view source on GitHub ↗
(
    &mut self,
    e: &KExpr<M>,
    depth: u16,
  )

Source from the content-addressed store, hash-verified

1147 }
1148
1149 // Nat primitive reduction
1150 if family == PrimFamily::Nat
1151 && let Some(reduced) =
1152 self.try_reduce_nat_with_succ_mode(&cur, nat_succ_mode)?
1153 {
1154 cur = reduced;
1155 continue;
1156 }
1157
1158 // Native/string primitives must run before projection-definition
1159 // rewriting. In the compiled environment, wrappers such as
1160 // `Subtype.val` and `String.toByteArray` are projection definitions;
1161 // once rewritten to `Prj`, the cheap primitive recognizers no longer
1162 // see the original head.
1163 if family == PrimFamily::Native
1164 && let Some(reduced) = self.try_reduce_native(&cur)?
1165 {
1166 cur = reduced;
1167 continue;
1168 }
1169
1170 // String literal primitives.
1171 if family == PrimFamily::Str
1172 && let Some(reduced) = self.try_reduce_string(&cur)?
1173 {
1174 cur = reduced;
1175 continue;
1176 }
1177
1178 if flags.is_full()
1179 && let Some(reduced) = self.try_reduce_projection_definition(&cur)?
1180 {
1181 cur = reduced;

Callers 2

nat_offset_or_zeroMethod · 0.80

Calls 5

collect_app_spineFunction · 0.85
nat_offset_or_zeroMethod · 0.80
dataMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected