Cannot start MIT Scheme - Heap Size exceeded - windows

For some reason I'm having trouble running MIT scheme. On my Dell, which runs Windows Vista, I can't even open MIT scheme; I get a message: "Heap Size exceeded", or something like that. I can run it fine on my Mac, but Edwin is a bit confusing. Does anyone know how to fix my problem on Windows, and where I can find some good Edwin tutorials? Thanks!

Edwin is a variant of Emacs which uses Scheme instead of Emacs Lisp. Take a look at the relevant sections of the MIT Scheme manual:
http://groups.csail.mit.edu/mac/ftpdir/scheme-7.4/doc-html/user_8.html#SEC55
Not sure why MIT Scheme wouldn't run on Windows, however, if you installed it on OS X, try just running mit-scheme from Terminal.app. This should just give you a Scheme REPL. You can enter Scheme expressions etc, and also load Scheme source files with (load "file.scm"). Finally, you can also load files from the command line with mit-scheme --load file.scm.
If all that doesn't work, are you sure you need MIT Scheme? You could try PLT Scheme/Racket, which would let you run Scheme code, you might have better luck in Windows. Not sure about that though.

Related

Interpreting SCHEME for SICP

I have read through a bunch of Structures and Interpretations of Computer Programs and it has really captured me. I love they way it explains programming concepts. But the problem is that I don't know how to get MIT Scheme working. I don't know much about how to quickly interpret/compile in languages that require a compiler/interpreter. (doing it in JavaScript is incredibly easy) I have tried DrRacket but would love to use sublime text then quickly run it.
I have downloaded the official MIT-SCHEME bundle but I have no idea on how to get it actually working after 3 hours.
Thank you for reading!
It sounds like you may be familiar with the sicp package for Racket that allows you to write programs in a #lang sicp language. If you're interested in running them from the command line a la Javascript, that's certainly possible; if you run
racket
on a file that starts with #lang sicp (and you have the sicp package installed), it should run fine at the command line. It should be easy to bind this to a sublime command.
HTH

Running Scheme in Jupyter (fka iPython)

I'd like to run Scheme under Jupyter. The traditional cell magic approach, which works in other cases (using %%bash, %%latex or %%ruby), is not available.
Note: I am not interested in Scheme Calypso, which does not have the whole Scheme functionality. I just want to run my Scheme installation at /usr/bin/scheme.
You can't. You can't just run an arbitrary installation in Jupyter - you need a dedicated kernel. You've already ruled out the existing Scheme kernel so I don't know what you're expecting. Perhaps ou can write your own Scheme kernel?
Calysto Scheme has much of a full Scheme language specification. You can try it live here: https://jupyter.org/try
If you find it missing something that you would really like to have, please let us know!

How do I run a scheme script from notepad++/cmd/powershell?

In python, I add python and the path of the file, and my script will run.
In haskell, I invoke the GHC compiler on my file to make an executable, or I load GHCi and load the path of the file to use functions, and my script is running.
In Scheme, neither type of approach works for me. Everywhere I search, I only hear about emacs and SLIME. I am not interested in either. I just want to write scripts in notepad++ or any other simple text editor, and either run them through a scheme interpreter, or compile it into an exe, for the purpose of testing code from the MIT SICP book.
I installed MIT/GNU Scheme for learning purposes. I am not interested in Racket because of how different it is from Scheme now (I don't want to confuse myself further, I just want to learn the basics.)
One thing that is contributing to my confusion is the following. When I open mit-scheme through the start menu shortcut, it opens the edwin editor (its tutorial (C-h t command) is apparently "corrupted" so I can't use that instead of notepad++ nor would I want to at this point (just too frustrated with it)). The file location for the edwin editor is in the bin folder. The bin folder though, only has 2 files: mit-scheme.exe and dibutils.dll. If I double-click on mit-scheme.exe it just gives me an error, but apparently using the shortcut opens the edwin editor (that is supposed to be located in the same folder as mit-scheme.exe (it isn't)).
Why is all of this so convoluted? Isn't there a simple way to get my scheme scripts running? I just want to run things like:
(define hello-world
(lambda ()
(begin
(write ‘Hello-World)
(newline)
(hello-world))))
Searching for solutions online was futile for me, I've already wasted many hours- so hopefully I can finally get an answer here.
Thank you.
EDIT: I am on windows 7 and *nix operating systems isn't an option.
mit-scheme has the --load switch. thus
mit-scheme --load path/to/script.scm scrip2.scm -- args ...
I think you also can use Racket to run standard r6rs like this:
plt-r6rs script.scm
For r5rs there is plt-r5rs. Racket can also make executables that run faster with raco exe script.scm.
EDIT
BTW: plt-r6rs is for running programs using the standard R6RS scehem report. plt-r5rs is for running programs using the standadr R5RS scheme report. I have no idea what you mean by "different it is from Scheme". Racket has it's own language, which is the default, which is it's own incompatible dialect of Scheme, but it is not a reason for not using the software. It's like not using gcc because it supports a non standard C++ language and ignoring that you can get ot to behave standard with switches.
There is only one R7RS-small implementation, the reference implementation chibi scheme. Every imlpementation is waiting for the full R7RS report I guess so it's R6RS which is the current standard.
The lists in R5RS and R6RS are mutable (but in R6RS you need to import (rnrs mutable-pairs), but thats a part of the standard. Try not import racket libraries from the standard schemes unless you have no other choice. Check the SRFIs first.
There are not so many Scheme versions and scheme implementations. For every popular programming language that has been for at least 10 years there are more than 3 implementations and several incompatible versions of the standard. If you think there are few implementations of the languages you mentioned you are quite wrong. Python has many implementations and incompatible standard versions. Haskell also has many implementations and versions of their standard. Scheme is from the 70s so it's been around for 40 years so it's only natural that there are more versions of Scheme than Haskell and Python.
This is how I was able to run scheme code from notepad++,
I put to notepad++ run configuration:
"C:\Program Files (x86)\MIT-GNU Scheme\bin\mit-scheme.exe" --heap 512 --library "C:\Program Files (x86)\MIT-GNU Scheme\lib" --load "$(FULL_CURRENT_PATH)"
and then I was able to run. However, I had to save file first, otherwise it is not running. Also notice that (+ 2 2) is not printing as a result, But If I call procedures it is working fine.
sample

Using MIT/GNU Scheme

I have downloaded the MIT/GNU Scheme implementation of LISP in order to understand Structure and Interpretation of Computer Programs. However, I am a bit confused about what I am dealing with when I launch the program. When the program is launched, I get two windows: the "MIT/GNU Scheme" window, and the "Edwin: *scheme*" window.
What are these two windows used for? Is the "MIT/GNU Scheme" one some sort of command-line interpreter? While the other is where code can be written and saved?
Further questions: If the MIT/GNU Scheme is a command-line interpreter, how can I get the "1 ]=>" prompt to show. And if the other is where I write programs, how do I test and save the programs?
MIT/GNU Scheme should start off as minimized. It is just a background console window that starts the editor. You need not pay attention to it (nor can you interact with it).
Edwin: *scheme* is the Edwin text editor, which looks to me like some sort of Emacs derivative. It allows you to not only write Scheme scripts but also evaluate Scheme expressions interactively. However, to do this you will need to learn the appropriate keybindings and commands, and some familiarity with Emacs would certainly help here too. Therefore I suggest reading the documentation.

Recommendations for a lisp setup on Mac OS X (any dialect)?

What is your Mac OS X (Intel) based lisp setup (of any dialect), how do you like it, and how painful was it to set up? I'm looking for a versatile lisp that is easy to set up, but if you feel strongly about investing more effort, or even money, I would like to hear why you think it's worth it.
I am currently using newLisp, which was a breeze to set up and gives me simple access to things like graphics and sound. I have heard of SBCL with emacs and slime, but that seems a real pain to set up, and I'm still not friends with emacs. I want to see if there's anything I'm missing out on. I would primarily be using this for pleasure, with no commercial goal in mind.
Please recommend only one setup per answer to enable voting, but feel free to submit multiple answers.
Ready Lisp:
Ready Lisp is a binding together of several popular Common Lisp packages especially for Mac OS X, including: Aquamacs, SBCL and SLIME. Once downloaded, you’ll have a single application bundle which you can double-click – and find yourself in a fully configured Common Lisp REPL.
It’s ideal for OS X users who want to try out the beauty of Common Lisp with a minimum of hassle. It could also be used by teachers to give their Mac students a free, complete Common Lisp environment to take home with them.
The best Lisp for Mac OS X is LispWorks. It is commercial though. Installation is done with an installer in a few seconds. It is started then with a double-click from the programs folder. It has a Cocoa-Bridge and the user interface is written with it, but based on a portable substrate - so the same development environment is available for Windows and Unix/Linux/FreeBSD.
I suppose it depends on what you mean by "setup". Clozure CL (previously Open MCL) has an experimental Cocoa bridge, and you can even build a smallish IDE as well (just fire it up and do a (require "COCOA-APPLICATION") and it'll build the .app bundle for you). I use vim myself, but you're free to use whatever editor you like (+ Interface Builder), of course. CCL supports Emacs+Slime, but does not require it.
Try PLT Scheme. It is mature, has lot of libraries and comes with an IDE.
Gambit scheme is a "complete, portable, efficient and reliable implementation of the Scheme programming language":
Gambit consists of two main programs: gsi, the Gambit Scheme interpreter, and gsc, the Gambit Scheme compiler. The interpreter contains the complete execution and debugging environment. The compiler is the interpreter extended with the capability of generating executable files. The compiler can produce standalone executables or compiled modules which can be loaded at run time.
The Gambit compiler allows Scheme to be compiled to C, with some pretty cool applications, like writing an iPhone app in Scheme (with a REPL for remote debugging).
There is a FFI for Gambit so you can use external C libraries.
There is an installer or you can install via MacPorts.
You could install guile. I'd use fink.
That is easy, but it gives you a fairly lightweight scheme installation.
General Comments
Most lisps are not that hard to set up on OS X if you're used to working on the command line, though some are harder than others. I think the hardest to set up are CMUCL and Clozure; if memory serves, you need to make a symbolic link into a directory on your path if you don't want to run them from their respective directories (they don't install an executable into /usr/local/bin on installation). In any case, you'll put more work into getting Slime going in Emacs than you will actually installing a lisp. New Lisp is an easy install from the OS X gui, installed from a OS X package (making it the easiest install of all lisps except, perhaps, for PLT Scheme).
I do recommend using a some form of IDE, be it Emacs + Slime or the LispWorks or Clozure IDEs. People use other editors, but those are the ones that have been tailored most to programming in lisp. Personally, I wouldn't enjoy programming in lisp if I couldn't use Emacs + Slime, but I've put in a lot of time to learn the Emacs and Slime commands.
Implementation Recommendation
Here is a specific recommendation that is different from the others. If you are new to lisp and not too picky that it be Common Lisp, you should look at PLT Scheme. It comes with an IDE and an implementation (DrScheme and mzscheme) that can't be beat for ease of installation and use for a beginner. PLT Scheme comes with lots of extensions to Scheme that make is easier to use for more programming tasks than the other Schemes as well.
Easiest solution: (assumes you have the excellent Mac Ports installed)
Step 1:
$ sudo port install mit-scheme
Step 2:
$ scheme
Step 3:
Read Structure and Interpretation
of Computer Programs http://mitpress.mit.edu/sicp/full-text/book/book.html
Clojure is a wonderful lisp. it is truly modern lisp designed for pragmatic concurrent programming. It compiles to the JVM and can call and be called by java nativity with no wrapping and a minimum of ceremony.
clojure.org
try: XMLisp for OS X (FOSS)
3D: Open Agent Engine: scene graph based mini engine, 3D objects, animation, mouse hovering, selection, camera control, texture management
2D: controls: layout managers, buttons, sliders, text
http://code.google.com/p/xmlisp/
It is an extension of Clozure CL. IDE is included. You should be able to get this running in no time.
Alex

Resources