整理自网络,供查阅使用.
在交互式执行方式下,系统(启动后)将在一个窗口显示版本信息,最后是提示符:
1 ]=>
键入的程序代码将显示在提示符之后。
此时系统执行 read-evaluation-print 循环(读入-求值-打印循环,REPL),可以键入符合 Scheme 语法要求的表达式(程序),要求系统对其求值。表达式中可以任意换行。一旦系统读到一个完整的表达式,就会对它求值(计算),并打印出求得的值。
Scheme 不区分标识符中的大写和小写,define 和 DEFINE,Define 同样对待。
启动后的提示符 1 ]=> 中的数字 1 表示当前系统运行在第一层“读入-求值-打印循环”。如果求值中出错,系统将进入更高层次的“读入-求值-打印循环”,也是系统的出错处理循环。在出错循环中仍然可以像在第一层循环一样使用 Scheme 系统,还可以做一些其他事情(参看 Scheme 文档)
概述Edwin 是 MIT Scheme 系统的一个窗口式的编辑使用前端。其功能和使用方式都像著名编辑器 EMACS,使用方面的进一步细节可以参考 EMACS。本页简单介绍 Edwin 的使用。启动 Edwin 实际上是先启动 Scheme 系统再启动一个 Edwin 前端。Edwin 是一个用 Scheme 写的交互式编辑器。其特点是支持 Scheme 表达式的编辑和求值。 介绍 Edwin 的文档里常提到 buffer,这个概念类似于一般多窗口编辑器的编辑区。 两种不同执行模式在 Edwin 执行时,一个编辑区(称为一个 buffer)可能处于两种不同的运行模式:
建议大家在编辑模式下编写程序(函数的定义,所需基本数据的定义等),检查无误后(例如,函数能正常定义了)保存,然后在 REPL 模式里装入(用 Scheme 语言的 load,见使用简介)并做各种试验和调试(输入并求值各种具体计算表达式)。 记号:C-x,C-c 等表示按住 Ctrl 键的同时按 x 或 c 键;M-p 等表示在按住 Meta 键的同时按 p键。在 PC 键盘上没有 Meta 键,可以直接用 Alt 键加上 p 键,或者先按 Esc 键再按 p 键。 帮助信息在 Edwin 里按 Ctrl-h t,它会装入一个 tutorial 文件,其中讲述了各种常用命令。在 Windows 的 Scheme 程序菜单里的 Documentation 包含大量与 Scheme 有关的信息。网上可以找到许多相关信息。下面是一些有用链接: |
退出系统C-x z (表示按 Ctrl-x 后按 z 键):从 Edwin 中退到 Scheme 的命令交互状态。此时 Edwin 挂起,可用 (edit) 唤醒挂起的 Edwin,回到挂起前的状态。C-x c :停止 Edwin 并回到 Scheme 的命令交互状态。 C-x C-z:停止 Edwin 并挂起 Scheme 系统。再次启动 Scheme 将唤醒挂起的 Scheme 系统,回到挂起前的系统状态。 C-x C-c:停止 Edwin 和 Scheme 系统。 求值 (exit) 退出 Scheme 系统。 |
简单编辑和执行光标移动可以通过普通移光标键,或通过鼠标点击。用 Delete 或 Backspace 键删除字符。在正常输入过程中,每次输入右括号 "(",环境将自动闪烁对应的左括号 ")"。 对于多行输入的表达式,换行后按 C-i,系统能将光标自动对齐到合适位置。对于各种复杂的 Scheme 表达式,例如 let, cond, 等等,Edwin 都定义了很好的对齐方式。 求值表达式的方式:将编辑光标(反色小块)移到表达式后面,按键 C-x C-e 。 被求值的表达式将由另一个线程求值,在求值过程中我们仍然可以做编辑工作。 C-c C-x 或 C-c C-u,用于杀掉正在进行的求值。 C-c C-b 中断当前求值,进入断点状态。 翻页等命令:C-v:向下翻一屏 M-v:向上翻一屏C-a:移动到行首 C-e:移动到行尾 两个常用操作在 REPL 模式下,所有输入的历史都有记录。这使我们可以很方便地再次使用曾经输入过的表达式。 M-p 反向枚举曾经输入的表达式,M-n 正向枚举这些表达式。这里列出了 Edwin 的常用命令(英文) 这里列出了 EMACS 的一些常用命令(中文,在 Edwin 里都可用) |
调试如果正在进行的求值出错,系统将给出一些错误信息,并询问是否启动调试器(debuger)。回答 y 要求系统启动调试器,显示出一个新的调试器窗口;回答 n 回到原求值循环。(这部分内容将进一步建设) |
编辑技术 |
其他Edwin 前端是一个功能强大的编辑器,允许用 Scheme 对其功能进行任意的扩充。这方面情况与 EMACS 类似,只是这里用的扩充语言是 MIT Scheme(EMACS 用的是 EMACS Lisp)。请参考 MIT Scheme 文档和 EMACS 文档。 |
how to use the Edwin
1, if there is no META or EDIT key, Alt is that key.
2, to end the session, C-x C-c.
3, C-v, to the next screen
4, C-g will quit what it was doing and allow you to enter it in again from scratch.
5, C-k kill from the current cursor position to end of line
6, whenever you kill something bigger than a character, Emacs saves it for you. to yank it back, use C-y.
7, C-x C-e to evaluate the expression.
8, you are now in the tutorial screem.
Type: C-x b *scheme* to get into an evaluation buffer.
Type: M(Alt)-p to access the history of *scheme*.
Type: C-x b tutorial to go back to the tutorial screem.
9, undo: C-x u, it undo the last command.
10, File: C-x C-f filename --> enter into the "finding buffer" to find a file.
if the file exits, it find the file, if not
exits,create a file named filename.
C-x C-f C-g --> cancel the "finding buffer" without doing anything.
C-x C-s --> Save the file.
11, buffer: C-x C-b: if you find a new file with C-x C-f in the
Edwin,the first file remains in the Edwin,Type C-x C-b
to find them (it shows a list of all the buffers now in
the Edwin). Any text you see in the Edwin, has to be
in some buffer. if you have edited a file or something
and go to another file without saving the first one, the
changes would not save, unless you reback to the first
file, and C-x C-s. There is a way to save all the changed
file, that is C-x s. the command goes through the list
of buffers, and saves every changed buffer.
12, C-x 1 remove the document from the screem.
13, C-s find a word or string, type C-s,and then, type in the word,
once, you would find the
word, again, you will find the next occurrece of the
word you have typed in. type in C-g, you will go back to the
first place where you press "C-s".
14, C-x 1 display only one window.
15, C-h ? tell you what kinds of help you can get.
16, C-h c + command: tell you the basic intro to the command.
to get more information, use C-h k + command.
to get info of a function, use C-h f + function