# Implementing beta-reduction with de Bruijn indices To improve beta reduction, a good way to go is to use [de Bruijn indices](https://en.wikipedia.org/wiki/De_Bruijn_index). In terms of actual implementation it would mean to add one more intermediate language, call it core-expressions. Core expressions would have essentially the same abstract syntax as expressions, but the case for lambda-abstraction called `EAbs` would be different. After defining the abstract syntax of core expressions, one would add a Haskell function of type `Exp->CoreExp`, translating lambda-calculus with variables to lambda-calculus with de Bruijn indices. Then one modifies the interpreter so that it runs on `CoreExp` instead of on `Exp`. The new `evalCBN` would be the same as the old one with the exception of application/beta-reduction/substitution.