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

Method is_let_var

crates/kernel/src/tc.rs:501–511  ·  view source on GitHub ↗

Whether a de-Bruijn variable points at a let-bound local.

(&self, idx: u64)

Source from the content-addressed store, hash-verified

499 pub fn lookup_let_val(&mut self, idx: u64) -> Option<KExpr<M>> {
500 let n = self.ctx.len();
501 let idx_us = usize::try_from(idx).ok()?;
502 if idx_us >= n {
503 return None;
504 }
505 let level = n - 1 - idx_us;
506 let val = self.let_vals[level].as_ref()?.clone();
507 Some(lift(&mut self.env.intern, &val, idx + 1, 0))
508 }
509
510 /// Whether a de-Bruijn variable points at a let-bound local.
511 pub fn is_let_var(&self, idx: u64) -> bool {
512 let n = self.ctx.len();
513 let Some(idx_us) = usize::try_from(idx).ok() else {
514 return false;

Callers 3

whnf_core_with_flagsMethod · 0.80
whnf_no_delta_implMethod · 0.80

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected