Ninety-Nine Scheme Problems--引

来源:互联网 发布:爬虫技术教程 php视频 编辑:程序博客网 时间:2024/05/20 22:40

很喜欢Lisp这门语言。最初接触是在用gimp时无意了解到的,因为gimp可以使用Script-Fu写脚本,而这门语言基于Scheme,这个时候的了解仅限于大体的语法。随后,接触了Emacs的elisp,也仅仅是简单的文件配置。总体上,对Lisp语言的了解是零星、不系统的。是时候好好学习一下了。

Lisp方言很多,最后选择了Scheme进行系统学习,最吸引我的大体有两点:
- 语言很小,语言规范的内容也才有50多页【R7RS small】
- 麻雀虽小,五脏俱全

看到Ninety-Nine Prolog Problems和Ninety-Nine Lisp Problems两篇,作为学习和实践资料,这里给出其Scheme版本。

问题说明

问题的组织方式基本与Ninety-Nine Prolog Problems和Ninety-Nine Lisp Problems类似,99个问题分为以下7类:
1. 列表操作(Working with lists)
2. 算术计算(Arithmetic)
3. 逻辑和编码(Logic and Codes)
4. 二叉树(Binary Trees)
5. 多叉树(Multiway Trees)
6. 图(Graphs)
7. 其他(Miscellaneous Problems)
每个问题的前面都有星号表示难度的等级,引用Ninety-Nine Prolog Problems的说明

The problems have different levels of difficulty. Those marked with a single asterisk (*) are easy. If you have successfully solved the preceeding problems you should be able to solve them within a few (say 15) minutes. Problems marked with two asterisks (**) are of intermediate difficulty. If you are a skilled Prolog programmer it shouldn’t take you more than 30-90 minutes to solve them. Problems marked with three asterisks (***) are more difficult. You may need more time (i.e. a few hours or more) to find a good solution.

语言标准和实现

当前最新的语言规范是r7rs,给出的代码符合该标准。http://scheme-reports.org这里给出了Scheme语言的详细状况,包括各个版本的语言规范和各个实现对标准的支持情况。目前符合r7rs-small标准的实现不太多,我使用的sagittarius-scheme。

1 0
原创粉丝点击