Local and Global Variables

So far our examples have all been relatively simple and straightforward. For example, we have only used single functions, there have been very few global variables (and rightly so!) and we’ve always assumed on processing core. When we looked at Lifetime Diagrams, we saw the importance of keeping everything straight and simple, so that we could have multiple copies of functions running at the same time.

All supercomputers are highly parallel. Take a look at the current Top 500 Supercomputers in the world; as of June 2018, the world’s most powerful supercomputer, the Summit Supercomputer, at Oak Ridge National Laboratory in the USA has 200,000 separate processing cores. How can we design programs that will efficiently use all these cores? We’re going need hundreds of functions, we’re going need millions of copies of the same function running at the same time, and we’re going to need functions that can take other functions as parameters, to help us change the way programs work. And somehow, we’re going to have to keep track over everything.

To help with this, we’re going to introduce some formal notation to do this, starting with what is referred to as Free and Bound variables in λ calculus.