|
The ML interpreter has a very clear, simple operation. The process of
interpretation is just that of reduction. An expression is entered at the
prompt and is reduced according to a simple set of rules.
Example: Evaluate times4(5) | ||
| times4(5) | =double(double 5) | because times4 x=double(double x) for any value of x. Specifically we let x be 5 here. |
| =double(2*5) | we replace the sub expression double 5 with 2*5 as the equation for double permits. | |
| =double(10) | We simply replace 2*5 with 10. | |
| =2*10 | Use the equation for double again. | |
| =20 | ||