May 23th Wednesday (五月 二十三日 水曜日)
来源:互联网 发布:java语言和c语言的区别 编辑:程序博客网 时间:2024/05/01 01:23
The "(map proc list1 ...)" applies a procedure element-wise to the elements of the lists and
returns a list of the results, in order. The dynamic order in which the procedure is applied
to the elements of the lists is unspecified.
But the "(for-each proc list1 ...)" is guaranteed to call "proc" on the elements of the "lists"
in order from the first element(s) to the last, and the value returned by "for-each" is unspecified.
The "(apply proc arg1 ...)", calls "proc" with the elements of the arguments list as the actual
arguments.
(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))))))))))
Let's come back to the "with-syntax" again. Firstly, there is a discrepancy between the environment
of defining a macro "loop" and the enivronment of invoking the macro "loop".
(syntax (call/cc (lambda (break)
(let f () e ... (f)))))
The above codes is a classic loop and break segment in scheme. For escaping from a loop, there is
a current continutaion. How to put a invoked current continuation into the "with-syntax" macro.
(break (datum->syntax-object (syntax k) 'break))
This is a key code. It binds a invoking environment to a 'break label. Now the "with-syntax" can
matchs its pattern with it.
(_ ((p e0) e1 e2 ...))
The "_" is "with-syntax" macro name. The (p e0) matched (break (datum->syntax-object (syntax k) 'break)).
The "p" is 'break now. So, in actual fact, (p ...) is (break ...). First "p" matched from "with-syntax"'s
pattern matched; second "p" must matched pattern from (list e0 ...). In (list e0 ...) there is a
invoking current continuation. Okey, the rest codes can escape from a loop by using the current continuation.
- May 23th Wednesday (五月 二十三日 水曜日)
- May 13th Wednesday (五月 十三日 水曜日)
- 2008 May 23th Friday (五月 二十三日 金曜日)
- May 27th Wednesday (五月 二十七日 水曜日)
- May 9th Wednesday (五月 九日 水曜日)
- May 16th Wednesday (五月 十六日 水曜日)
- May 6th Wednesday (五月 六日 水曜日)
- May 20th Wednesday (五月 二十日 水曜日)
- 2008 January 23th Wednesday (一月 二十三日 水曜日)
- 2008 July 23th Wednesday (七月 二十三日 水曜日)
- 2008 May 21th Wednesday (五月 二十一日 水曜日)
- May 30th Wednesday (五月 三十日 水曜日)
- 2008 May 7th Wednesday (五月 七日 水曜日)
- 2008 May 14th Wednesday (五月 十四日 水曜日)
- 2008 May 28 Wednesday (五月 二十八日 水曜日)
- June 13th Wednesday (六月 十三日 水曜日)
- 2008 May 13th Tuesday (五月 十三日 火曜日)
- 2008 February 13th Wednesday (二月 十三日 水曜日)
- MagicAjax.NET 的 ClientEventTrigger 用法
- May 21th Monday (五月 二十一日 月曜日)
- 工作(三年)以后.....
- May 22th Tuesday (五月 二十二日 火曜日)
- 帧结构集相对路径问题
- May 23th Wednesday (五月 二十三日 水曜日)
- Tomcat命令行启动技巧
- May 24th Thursday (五月 二十四日 木曜日)
- May 25th Friday (五月 二十五日 金曜日)
- jsp开发聊天室
- 数据库设计中动态列的设计方法
- 技术歧视和势利
- May 28th Monday (五月 二十八日 月曜日)
- 开发计划的内容