Conversation

Here's my take: with de Bruijn indices, variables need to be incremented when you put them under a new binder. They refer to binding sites relative to their occurrence. Levels refer to them absolutely and thus don't need incrementing under a new binder.
1
2
My (probably bad) understanding is that the nifty thing about indices is that you can avoid having to rename things. The nifty thing about levels is that you can move around terms without having to shift indices. Combining them together with NbE gets you the best of both somehow?
1
1
Indices are nicer for writing evaluators (they basically say how far up the stack to look for the value). The way I see it, levels are nice for free variables, and indices for bound variables. Boundness vs freeness depends on your perspective :-)
1
2
Oh yeah, I've done that before, it was not nice! Definitely would rather not do that. I'm thinking more about having captures explicit… but I haven't really thought it through. Kind of like contextual type theory I think?
1
Yeah, big fan of the compilation to byte-code stuff! More just lamenting about how nested lambdas/currying seems very ordered/listy when what I really want is to be able to build up graphs of dependencies between things. Still trying to articulate what I mean though.
1
1
Show replies
Yeah, I'll believe you - it's a mild annoyance. I think I'm going to have to use immutable data structures for environments (in my Rust implementation). I think my struggle is more to do with how to then progress from there to doing more interesting stuff with dependency graphs.
1
Show replies