# SICP Solutions

### Chapter 4, Metalinguistic Abstraction

#### Exercise 4.21

This is interesting way to solve the of simultaneous definition.

I am first writing solution for part(b)

#### (b)

Let’s start from Louis’s suggestion in the previous exercise. Why his suggestion was not working?

The reason is if we evaluate lambda expression for even? then odd? can not be found. Similarly evaluating lambda expression for odd? then even? is not found.

Why? As we saw in prev. exercise: the scope in which lambda expression for even? or odd? is evaluated does not contain the bindings even? and odd?.

So, how can we fix this situation?

What if instead of even?’s expression calling odd? and odd?’s expression calling even?, there is a way we can make these invocations by passing the lambda expression of these procedures to each other!

What I mean is, the problem was we don’t have name binding of even? to its definiton and odd? to its definition. So why not we instead pass the procedure to be invoked!

We pass lambda expression of even? to odd? and similarly we pass the lambda expression of odd? to even?.

In this way we are not dependent on binding of variable names even? and odd? to their respective lambda expressions!

Well thats it! Here is our procedure:

Well, it indeed solved the problem but it has decreased the readablity of the code!

#### (a)

This is simple now after doing part(a)

#### Complete Code

Since in next section, there will be quite a number of changes in code. Putting the complete code here till now.