ourtesy of Andreas Hoffman. Used with permission 16.410: Jump Starting With Scheme by Andreas Hoffman Introduction This jumpstart shows you the basics of getting Scheme started, running simple programs, that the Scheme installed in the 16.410 computer lab is the Windows vers Ban On simple editing and debugging, and exiting out of Scheme. The jumpstart is oriented towards Windows installations, but can be adapted for Unix and other installations. Note Please note that this jumpstart will give you only the most rudimentary skills in Scheme To get through the course, you will have to obtain a bit more information. The Scheme user and reference manuals are excellent resources, and are available as part of the Scheme installation; just go to the Windows Start menu, and select: Programs, MIT Scheme, Documentation. Please see the course web page for the url to the Scheme download site and the location and hours of the course lab Hello world Start the Scheme interpreter by going to the Windows start menu and selecting Programs, MIT Scheme, Scheme. At the prompt, enter the following form ( display"Hello, World! " (newline)) The interpreter prints out Hello. World The interpreter also prints out a message indicating"unspecified return value". This is not an error message; it simply states that the Scheme form you entered doesn't return any value. Some forms return values, some don't. Now, enter the following form (begi (display Hello, World! (newline)5) Now, the interpreter indicates the returned value(5). Let's exit Scheme(dont worry, we'll come back to it. To exit, simply enter the form (exit)
16.410: Jump Starting With Scheme by Andreas Hoffman Introduction This jumpstart shows you the basics of getting Scheme started, running simple programs, simple editing and debugging, and exiting out of Scheme. The jumpstart is oriented towards Windows installations, but can be adapted for Unix and other installations. Note that the Scheme installed in the 16.410 computer lab is the Windows version. Please note that this jumpstart will give you only the most rudimentary skills in Scheme. To get through the course, you will have to obtain a bit more information. The Scheme user and reference manuals are excellent resources, and are available as part of the Scheme installation; just go to the Windows Start menu, and select: Programs, MIT Scheme, Documentation. Please see the course web page for the url to the Scheme download site and the location and hours of the course lab. Hello World Start the Scheme interpreter by going to the Windows start menu and selecting: Programs, MIT Scheme, Scheme. At the prompt, enter the following form: (begin (display "Hello, World!") (newline)) The interpreter prints out Hello, World! The interpreter also prints out a message indicating "unspecified return value". This is not an error message; it simply states that the Scheme form you entered doesn't return any value. Some forms return values, some don't. Now, enter the following form: (begin (display "Hello, World!") (newline) 5) Now, the interpreter indicates the returned value (5). Let's exit Scheme (don't worry, we'll come back to it. To exit, simply enter the form: (exit) Courtesy of Andreas Hoffman. Used with permission
Using Edwin Edwin is the editor that comes with Scheme. Edwin is based on Emacs, and therefore many of the keystroke combinations in Edwin are the same as they are in Emacs. You don't have to use Edwin to edit Scheme programs (you could do it in Wordpad, for example). However, you are highly encouraged to learn the basics of using Edwin; it will save you time later To start Edwin, go to the Windows Start menu, and select: Programs, MIT Scheme, Edwin. This will bring up the Edwin editor. Type in one of the previous hello world forms. Then, with the cursor at the end of the form, use the keystroke combination ctrl-x ctrl-e to evaluate the form Note that in the scheme editor forms are not evaluated automatically Now, let's write a Scheme program and save it in a file. First, to get a new buffer, do ctrl-x ctrl-f Edwin will prompt you for a path. Enter an appropriate path for your directory, and end it with the file name hello world. scm Scheme will indicate that this is a new file. now enter one of the previous hello world forms into the new buffer. When done, do ctrI-x ctrI-s This saves the file Next. do ctrl-x b This switches you back to the Edwin Scheme interpreter. Load the file Hello World.scm into the interpreter by doing (load [path where path] is the path for the Hello world. scm file Then do ctrl-x ctrl-e to evaluate. Note that the result is the same as when this was typed in directly to the interpreter. Leave Edwin by doing ctrl-x ctrl
Using Edwin Edwin is the editor that comes with Scheme. Edwin is based on Emacs, and therefore, many of the keystroke combinations in Edwin are the same as they are in Emacs. You don't have to use Edwin to edit Scheme programs (you could do it in Wordpad, for example). However, you are highly encouraged to learn the basics of using Edwin; it will save you time later. To start Edwin, go to the Windows Start menu, and select: Programs, MIT Scheme, Edwin. This will bring up the Edwin editor. Type in one of the previous hello world forms. Then, with the cursor at the end of the form, use the keystroke combination ctrl-x ctrl-e to evaluate the form. Note that in the Scheme editor, forms are not evaluated automatically. Now, let's write a Scheme program and save it in a file. First, to get a new buffer, do ctrl-x ctrl-f Edwin will prompt you for a path. Enter an appropriate path for your directory, and end it with the file name HelloWorld.scm. Scheme will indicate that this is a new file. Now, enter one of the previous hello world forms into the new buffer. When done, do ctrl-x ctrl-s This saves the file. Next, do ctrl-x b This switches you back to the Edwin Scheme interpreter. Load the file HelloWorld.scm into the interpreter by doing (load [path]) where [path] is the path for the HelloWorld.scm file. Then do ctrl-x ctrl-e to evaluate. Note that the result is the same as when this was typed in directly to the interpreter. Leave Edwin by doing ctrl-x ctrl-c