(define-syntax cons-stream
(lambda (x)
(syntax-case x ()
((_ a b) (syntax (cons a (delay b)))))))
(define-syntax car-stream
(lambda (x)
(syntax-case x ()
((_ s) (syntax (car s))))))
(define-syntax cdr-stream
(lambda (x)
(syntax-case x ()
((_ s) (syntax (force (cdr s)))))))
The above macros defined three operation on a stream. Note that the "cons-stream" is not defined a function. But you
can try it. You will find that definition can result in a infinite loop. Why? The scheme interpertor usually evaluates
a value before passing a argument into a parameter of a function. So, before making a stream the scheme interpertor trap
into trying making that infinite stream.
Today is the last work day this year. I have a holiday for four days. I am going to Shanghai again and take Mike yao's
computer, at once I will discuss with him about MPEG4.