Running simplescheme in DrRacket - scheme

I want to run code for 'simplescheme' (http://bryanchadwick.com/simplescheme/) on DrRacket to test it before putting it on the device's android. I could not find "#lang simplescheme" in the list of languages provided in DrRacket's menu.
I have 'simplescheme's android app (https://play.google.com/store/apps/details?id=chadwick.apps.simplescheme) installed on the device, but how can I test the code first on a desktop? I could not find 'simplescheme' interpreter for Linux or Windows on the net.
How can I solve this problem? Thanks for your comments/answers.

According the Simple Scheme web-site: http://bryanchadwick.com/simplescheme/index.html
Simple Scheme is a language inspired by Scheme and Racket.
This means that the only implementation of Simple Scheme is the Android one.
There are however two options to run your programs on the desktop.
The first one is to install an Android Emulator and run Simple Scheme in the emulator. This will allow you to run the real Simple Scheme.
The other options is to use #lang racket and restrict your self to use the constructs that are supported by Simple Scheme: http://bryanchadwick.com/simplescheme/index.html#functionlist
On the plus side this allows you to use DrRacket, but you risk using a construct missing from Simple Scheme.

NB! This answer is off topic as it's about Simply Scheme and not SimpleScheme. I'll leave it here as the names are rather similar
Racketeer and SO-er Danny Yoo has made a Racket module language to support Simply Scheme in the racket language suite. In Racket with the bottom left dropdown set to "Determine language from source" and replace the definitions window, including the #lang line to the following:
#lang planet dyoo/simply-scheme:2
(se (butlast (bf "this"))
"world")
And press RUN. It will download and install the language and then you'll see the answer (hi "world"). The first time around you might see an error, but my experience is that it will go away on a consecutive run.
The definitions will have all the simply scheme features described in the the documentation. Happy hacking!

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

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.

How to run mzscheme on DrRacket?

I have to make sure that my code is compatible with mzscheme but I don't know how to use it on my school's ssh servers. Is there anyway to test if my code is compatible with mzscheme on DrRacket?
Rackets default language was renamed from #!scheme to #!racket when the whole thing changed name from PLT to Racket. #!mzscheme is an old version of this which is made as a legacy language.
You switch language by making the language name the very first line in your source files. also instead of #!language you can write it more verbose as #lang language. It is exactly the same.
The legacy language uses the #!racket language pairs, which are immutable. Thus you cannot use set-car! and set-cdr! with the legacy library. If this is a problem use #!r5rs instead.
The bin directory installed with DrRacket (i.e., /Applications/Racket v6.3/bin on Mac OS X) has mzscheme as a working binary; you can just use it.
Also on DrRacket GUI, you can specify to use MzScheme with #lang mzscheme at the first line.

OS X Scheme Language (dialect for lisp)

I've only learned Python, and have recently begun to learn a new language called Scheme. I have a few basic questions regarding Scheme. 1) If I want to open a scm file on sublime text 2, can I just select "Lisp" for my language settings? 2 To run python on terminal, all I had to do was python file.py, what command do i do to open a scm. file on my os x.
1) Yes. You could also install a more Scheme oriented version.
2) Yes. Depends on the implementation. For racket you can start with plt-r6rs-script file.scm, plt-r5rs-script file.scm or you can compile raco exe file.scm and then just run file which then is a executable. Racket also had an IDE called DrRacket suitable for programming, debugging and running in the IDE and it supports standard Scheme versions such as R5RS, R6RS as well as it's own languages racket, typed racket and lazy racket. Don't confuse the language racket with the whole imlementation with the very same name that also runs Scheme very well.
For ikarus you do ikarus --r6rs-script file.scm
If you're looking to pick up a Scheme dialect, you may want to do it via Racket. At that point, if you're comfortable with the terminal, you can go through their Systems Programming With Racket tutorial, which will clarify how you'd go about editing and running scheme files from a command line.

Resources