First, let's take a look at some of the built-in functions
(cons x y), which binds X and y into a sequence of
(Car z), the function is to extract the first element of the Z-order pair
(Cdr z), which is the second element for extracting Z-order pairs
It's easy to see that this thing is a bit like the class in OO language, car and CDR are get methods, and X and Y are member variables.
But, but!
The function of the programming way, incredibly can use the process to achieve these three functions! It's unbelievable.
Here's a look at the implementation process
(define (cons x y) (Lambda (m) (m x y))) (Define (Car z) (Z (lambda (x y) x))) (define (Cdr Z) (Z (lambda (x y) y)))
First, the cons process accepts two elements, but instead of returning the data we imagined, it returns a new process with process parameters.
Secondly, in the car process, accept this cons process, and pass a new process to it, and finally according to the cons parameter table to read out the data
It was incredible, an eye opener.
"SICP reading Notes (ii)" Using process to glue data--the message passing mechanism of cool hanging