X10D
X10D

Reputation: 620

How to list all intermediate steps of evaluation in Scheme

For example if there's the expression:

(map (lambda(x) (add1 x)) '(1 2 3))

It evaluates to:

'(2 3 4)

How to display all the intermediate steps which in this case will be:

(map (lambda(x) (add1 x)) '(2 2 3))
(map (lambda(x) (add1 x)) '(2 3 3))

Upvotes: 2

Views: 173

Answers (1)

river
river

Reputation: 1028

I think the best way to do this would be to start by making your own lambda calculus interpreter and adding the extra scheme features you need, and then modifying that interpreter to produce the execution trace that you want.

This could get you started with writing an interpreter http://matt.might.net/articles/implementing-a-programming-language/

Upvotes: 1

Related Questions