(shift this diff var)
shift
is used by both normalization and type-checking to avoid variable
capture by shifting variable indices.
(shift e diff {:keys [i x]})
modifies the expression e
by adding diff
to the indices of all variables named x
whose indices are greater than
(+ n m)
, where m
is the number of bound variables of the same name
within that scope.
diff
is always +1 or -1, because we either:
1
to avoid variable capture during substitution1
when deleting lambdas after substitution`shift` is used by both normalization and type-checking to avoid variable capture by shifting variable indices. `(shift e diff {:keys [i x]})` modifies the expression `e` by adding `diff` to the indices of all variables named `x` whose indices are greater than `(+ n m)`, where `m` is the number of bound variables of the same name within that scope. `diff` is always +1 or -1, because we either: * increment variables by `1` to avoid variable capture during substitution * decrement variables by `1` when deleting lambdas after substitution
(subst this var e)
Substitute all occurrences of a variable with an expression E.g. (subst this var e) ~ this[var := e]
Substitute all occurrences of a variable with an expression E.g. (subst this var e) ~ this[var := e]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close