Basic use of the MIT Scheme

Source: Internet
Author: User

The basic use of the MIT scheme is to install and start up the MIT scheme system is properly installed under Windows, and the program menu will have an MIT scheme directory that includes: Documentation: Open HTML scheme in browser format Documentation for the MIT GNU Scheme:edwin environment to start Scheme. Edwin is an Emacs-like editor if you prefer to use command-line interaction, you can use the following command to create a shortcut command, placed on your desktop or Command menu. Note Modify the directory to your system installation directory: "C:\Program files\mit-gnu scheme\bin\scheme.exe"--library "C:\Program files\mit-gnu scheme\lib" Edwin system exit C-x Z (means press the Z key after Ctrl-x): fallback from Edwin to Scheme's command interaction state. At this point the Edwin hangs and can be used (edit) to wake up the suspended Edwin and return to the state before the suspend. C-x C: Stops Edwin and returns to the Scheme's command interaction state. C-x c-z: Stop the Edwin and suspend the Scheme system. Starting scheme again will wake up the pending scheme system and return to the system state before it hangs. C-x c-c: Stop the Edwin and Scheme system. From the interactive loop into Edwin in interactive mode (edit) or (Edwin), will start or return Edwin Interactive execution in the exit at the prompt type the following expression and enter: N]=> (exit) The system will ask for confirmation. All the things that have been done in Scheme will be lost after this exit. Basic use: command-line interactive mode to enter, if you have entered a complete expression, the system will evaluate it and output the results in Edwin C-x C-E the left of the evaluation cursor a complete expression, m-z the evaluation cursor at that time in which the entire definition (a definition is an expression, Its opening parenthesis starts at the far left) the basic use of the Edwin mode under the command-line interactive mode uses the Mit-gnu-scheme document Scheme file operation to edit and mount the program file: If the program is longer, you can use the editor outside the system to write the program source files, and then use the load The function is loaded into the system. The following is an example of an absolute path: 1]=> (Load "E:\\TEMP\\TEST1.SCM") evaluates the expression, you can see the file loadingInformation. The load function can also be loaded into a compiled program file, as detailed in the scheme document "3.2 Loading Files" of the "MIT scheme User ' Manual". Use the function CD to convert the current working directory. Here is an example: 1]=> (CD "E:\\temp") you can then load the files in this directory directly with the file name. Save and restore the system Image: You can save the current running scene of the Scheme system for future response to this site. This saved site is called a "world image" or a "band". In fact, Scheme starts with a default band, and loading the compiler starts by loading another band. The function save-disk the current scene to a file. The following example saves the field to the file in the current directory image1:1]=> (disk-save "Image1") function Disk-restore restore the original saved in a file in the field: 1]=> (Disk-restore "Image1") read MIT Scheme Document: "MIT scheme Reference" introduces the detailed features of MIT scheme, "MIT scheme User's Manual" introduces the use of MIT scheme. The SOS introduced by "SOS Reference Manual" is an object system of scheme, and the IMAIL described in "IMAIL User's Manual" is a mail reader made with scheme. The following is a brief introduction to some of the issues related to the first two documents. The main content of the MIT Scheme Handbook is to introduce the functions provided by this scheme system, including predefined variables (variable), special forms (special form), and procedures (procedure, functions). Example of an instance of a procedure: Procedure:eqv? Obj1 OBJ2 process name is Eqv?, take two parameters. Examples of use: (Eqv? 3 2) Procedure:list object ... The procedure name is list and takes 0 or more arguments. Use cases: (List 1 2 3 4) Examples of special forms: special Form:lambda formals expression expression ... Special form, the name is lambda, followed by a parameter table and one or more expressions. Use case: (Lambda (xY) (+ x y) = = = Command-line mode using basic usage in interactive execution mode, the system (after startup) will display version information in a window, and finally a prompt: 1]=> The program code you typed will appear after the prompt. At this point the system executes the Read-evaluation-print loop (read-in-evaluate-print cycle, REPL), you can type the expression (program) that conforms to the SCHEME syntax requirements, which requires the system to evaluate it. You can break any line in an expression. Once the system reads a complete expression, it evaluates (computes) and prints out the evaluated value. Scheme does not differentiate between uppercase and lowercase in identifiers, define and define,define are treated the same. The number 1 in the prompt after startup 1]=> indicates that the current system is running on the first "read-in-evaluate-print cycle". If an error occurs in the evaluation, the system will enter a higher level of "read-evaluate-print cycle", which is also the error-handling loop of the system. The scheme system can still be used in the error loop as in the first loop, and there are other things you can do (see the scheme document) to exit one or more layers of "read-and-evaluate-print loops": You can use the Ctrl-u key combination to exit a layer of evaluation loops, and ctrl-g back to the first layer loop. Interrupt execution: Key combination ctrl-g: Kill the evaluation in progress and go back to the first layer REPL key combination ctrl-x: Kill the ongoing evaluation and return to the current REPL key combination ctrl-u: Kill the ongoing evaluation and go back to the previous level REPL key combination Ctrl-b: Pauses the current evaluation into the breakpoint REPL. can be used (continue) wake-up interrupt execution ===* Other detailed comments copied from: http://www.cnblogs.com/Henrya2/archive/2009/02/21/1395615.html, thank you

Basic use of the MIT Scheme

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.