ustanovka-kondicionera-deshevo.ru/libraries/2020-11-21/1942.php However, I could not make it work using Mac Terminal. I have tried to follow these articles: So, I'm looking for a simple method which allows me to write Scheme code using Mac Terminal. I have struggled for hours to try to install it. No need to install anything else.
Although it says Mountain Lion, it works for me Lion In fact it would work for any mac on Intel processor. What does it do, and how is that different from what you expect? Homebrew makes it easy for you. On Terminal, type: Edit The install script has been moved: At least on The install script has moved from raw. If you have the latest Xcode installed, running brew update would work IMO. However, if you don't have Xcode, then we both are on the same boat!
Failed executing: Homebrew has some prerequisites: For Yosemite After installing X If you are using MacPorts, the command is similar to what others have posted for homebrew - sudo port install mit-scheme That set me up pretty well on OS X The first command will be same.
For the bit version , first run this command: Success Result You definitely need to put local there. Edwin has a lot less configuration options available than emacs, because there are less library files available. Here the settings Sussman and myself use:.
To install these settings for yourself, simply place the. Both edwin and emacs provide excellent, self-contained tutorials that will walk you through all the basic commands you need to know to use the editor. How do you know what sort of things you can do in your editor? For example, how do you figure out that C-M-x will evaluate the scheme form at your cursor if you don't already know that? The answer is to use the following invaluable discovery commands:. Now seriously, use C-h m and take a look at all the different things you can do in your scheme mode and at the repl.
LISP is almost as old as programming itself, having been created just a year after Fortran, the first "high-level" computer language. REPL stands for Read Eval Print Loop, and it is similar to working at an interactive terminal where you enter commands, change your commands based on the results of previous commands, and save things for later use. REPL oriented programming stands in contrast to batch-based programming: Generally, as you are programming in scheme, you will have one window which contains the code you are writing, and one window which serves as your REPL.
You write some code perhaps a single function , evaluate that code, then move over to the repl and experiment with the code you just wrote. Based on your repl interaction, you go back to your code and make changes, and then the cycle repeats. You can also run some tests in the REPL and then copy the results of those tests into your main source file, to use as documentation of what the function is supposed to do for certain inputs.
This will be an effective way to prepare psets — you write code, then copy the answers to the problem from the REPL back to your source file. You can try using the REPL right now! First, create two buffers: The file should end in ". Now go back to the REPL and enter fib 5 again and you will see the function you defined in your scheme file evaluated and printed to the screen. This is really cool! If this were a C or Java program you would have to write a small test-harness, re-compile and then run the program again to do what you have just done.
As you work on building more complicated programs, you will begin to see the power of this method. In scheme, the ; character is the comment character. But historically, the number of ; characters used has meaning. Four ;'s means that this comment is the title or header of the file.
Three ;'s means the comment should be left justified. Two ;'s means that the comment should be indented as if it was code, and a single ; means that the comment should be right justified. There is also the This comment is useful for including test cases.
If you were completing the definition of fib for a pset, you might use a multi-line comment to include test cases like so:. Note that use can evaluate the fib 5 and fib 20 scheme forms using M-z or C-M-x even though they are in comments. Many problems are transparent if you have an interactive debugger. Instead of littering your code with display statements, you can examine the values of local variables while your function is running. At first glance this seems to be a reasonable definition — we return 1 if we are given 1 as input, otherwise we return n times the factorial of n decremented by 1.
Whenever an error is encountered during the course of evaluating an expression, mit-scheme puts you into this mode.
These options give some limited access to the debugger. You can either choose one of these options or type debug to enter the debugger proper. Here's an example transcript where I fix the problem of dec not actually being defined and repair the original factorial call while it is still being executed.
Now that we're in the debugger, we can view the chain of procedure calls which led us to this situation. This is a stack trace like you might know from java or C. Each line in this list is called a subproblem, because scheme works expanding and evaluating forms until it determines a value. Lines are procedures involving the REPL itself. We can view all the current bindings in the little environment created by the call to factorial this is like exploring the values of local variables in any other debugger.
This is a very simple environment, with only n , which is set to the value we entered into factorial , 3. Let's fix the problem — dec isn't defined, but we want it to be equal to the function lambda x - x 1. Using P in the debugger we can move out of the environment of factorial and back to the user environment, where we can define dec. Now, we re-evaluate the original problematic subproblem and continue the original call to factorial.
Note that if you are using edwin , you will be given an option to "start the debugger" in addition to the other options. If you start the debugger in this way, then you will get a very nice looking window that constantly displays many of the things you could otherwise access through the commands you have just been shown. Try it out; it's neat! Emacs Don't Panic! Written by rlm, larsj, lgilpin Updated Spring 1 Welcome Welcome to 6.
S, Adventures in Advanced Symbolic Programming! Table of Contents 1. Welcome 2. Use Athena 2. Using a pre-compiled Mac Binary 3.
Get an Editor 3. Which editor should you use? Installing Edwin 3. Installing Emacs 3. Customize your Editor 3. Emacs dot-file 3.
Emacs on Athena 3. Edwin dot-file 3.
Exploring your Editor 3. Discovery 4. Workflow in 6. REPL tutorial 4. Note on comments 5. Debugging scheme code 5. Start the debugger 5. Simple debugging walkthrough. Use your own computer Disadvantages: If you don't know whether you to pick the "i" or "x" option, run uname -m. I like to put the compiled scheme files inside the directory I use for the class.
Copyright C Massachusetts Institute of Technology This is free software; see the source for copying conditions. Image saved on Saturday January 26, at 4: Sussman uses edwin and he can help you with your edwin related problems emacs MUCH larger online community than edwin.