So, I am going to define a very simple function here and often

these kinds of functions come [UNKNOWN]

where you might think of constructive functions.

So, the idea that the function is constructing another function.

So, here's what I want to, I want to

create a function that that defines another, called make.power.

And what make.power takes as input is a number n.

Okay?

So, and inside the make.power function I define

another function called pow.

And pow is going to take an argument called x.

And and so what's going to happen is that

the power function is going to take the, then the,

take the argument X and raise to their

power N, okay, and so make that power returns,

with a function power as its return value and so you see inside the power function X

is a, X is a function argument but that's not a problem, but n is a free variable

because its not defined inside the power. Function.

However, N is defined inside the make.power function and so

since that's the environment in which the pow is defined.

It will find the value of N.

The pow, the power function will find the

value of n inside this, it's other environment.

So what happens is that I can call make.power and pass it a number like 3.

And then, it will return a function, which I'll sign to

be called cube.

And, similarly, I can pass 2 to make that

power and create a function that I'll call square.

So, now, when I, when I pass cube, the number 3 What is

it does is it raises 3 to the 3rd power, so I get 27.

If I call square on the number 3, it, it

raises three to the 2nd power, so it gives me 9.

And so, so, so now, I've cons, I've

got one function that can, that's capable of constructing

many different types of functions, and by raising to pow, to various powers.