I'm a new people to Scheme, when reading the SICP, I found:
->I need to read the "The Scheme programming language 4",
-->I need to read the r6rs,
--->I read "Yet another Scheme tutorial",
--->I need to read the "Writing Hygienic Macros in Scheme with Syntax-Case".
When reading the last one, I try:
(define-syntax with-syntax1 ;;;racket has a with-syntax
(lambda (x)
(syntax-case x ()
((_ ((p e0) ...) e1 e2 ...)
(syntax (syntax-case (list e0 ...) ()
((p ...) (begin e1 e2 ...))))))))
(define-syntax or1
(lambda (x)
(syntax-case x ()
((_) (syntax #f))
((_ e) (syntax e))
((_ e1 e2 e3 ...)
(with-syntax1 ((rest (syntax (or e2 e3 ...))))
(syntax (let ((t e1)) (if t t rest))))))))
I got a error: rest: unbound identifier in module (in phase 1, transformer environment) in: rest
//----------------------------------------------------------------
When using racket's "with-syntax" to define another or:
(define-syntax or
(lambda (x)
(syntax-case x ()
((_) (syntax #f))
((_ e) (syntax e))
((_ e1 e2 e3 ...)
;;;use racket's with-syntax
(with-syntax ((rest (syntax (or e2 e3 ...))))
(syntax (let ((t e1)) (if t t rest))))))))
call it as (or 1 2), the call will never end.
//---the root cause of the second problem had been found---------------------
My question is:
What's the problem there in the above two "or".
Is there any road-map(or, book list, one by one) I can follow to learn the Scheme/Racket?
I'm very interesting about the "hygienic macro" in Scheme, I want to learn how to write a macro, and, I also want to know the theory behind the hygienic macro.