Yesterday evening I eventually get the root of that strange phenomenon. There is rule that all schedule
commands must be sorted, in other words, every schedule command, except for the last, must be more early
than its latter; each schedule command, except for the first, must be more later than its former. They
are a good sequence.
However, I set the default zero value to initialize a schedule command. Obviously, I made a mistaken.
When sending a schedule command out, because other three commands was filled zeros there are not a good
sequence again. As matter of a fact, I always send four schedule command out how many commands is in a
schedule file.
Today I reviewed the syntax macro "with-syntax". I downloaded codes from Wangyin, my a friend.
(define-syntax with-syntax
(lambda (x)
(syntax-case x ()
((_ ((p e0) ...) e1 e2 ...)
(syntax (syntax-case (list e0 ...) ()
((p ...) (begin e1 e2 ...))))))))
(define-syntax loop
(lambda (x)
(syntax-case x ()
((k e ...)
(with-syntax ((break (datum->syntax-object (syntax k) 'break)))
(syntax (call/cc
(lambda (break)
(let f () e ... (f))))))))))
The "loop" macro is used to help us understand "with-syntax". When I met the "with-syntax" firstly,
I felt that I can met a monster. But it is not monstrous. For above example, we can know "break" is
used to jump out a loop, a instance of "loop" macro. The key is following.
(with-syntax ((break (datum->syntax-object (syntax k) 'break)))
Let's get the "with-syntax" inside. ((_ ((p e0) ...) e1 e2 ...) The "_" matched "with-syntax",
macro name. ((break (datum->syntax-object (syntax k) 'break))) is matched by ((p e0) ...).
The e1 e2 ... is those statements in a loop. They are not a key point to understand. It is uncomfortable
that the second (syntax-case ...), it is embeded into the first. But it just power.
Let's call up how to use the "syntax-case". (syntax x () ...). Yes, there is a "x". So, do you know
why there is a (list e0 ...) put inside the second (syntax-case ...). In that way, our second (syntax-case ...)
can work correctly. In my viewpoint, there is a anonymous macro like following code.
(define-syntax break
(lambda ()
(syntax-case s ()
((_ ...) (begin e1 e2 ...)))))
In "with-syntax" macro, we used "p" as a symbol variable to represent variant names. So, the "p" is
used to matched a macro name, this macro name must be in a syntax object. (datum->syntax-object (syntax k) 'break)
is necessary. OK. "'break" is just the macro name.
Why use (list e0 ...)? The (list e0 ...) is used to match "s". That is the rule of "synax-case".