mit-scheme

Error setting load-noisily? and auto-exiting in MIT-Scheme

自作多情 提交于 2019-12-06 08:46:24
In order to debug MIT-Scheme scripts with Vim, I want to be able to run the script file currently being edited as conveniently as possible. Here is what I'm doing: sicp.scm (set! load-noisily? #t) (define (abs x) (cond ((> x 0) x) ((= x 0) 0) ((< x 0) (- x)) ) ) (abs 42) (abs -24) (exit) After executing :!mit-scheme --eval "(load \"sicp\")" when editing sicp.scm in Vim, I get: Image saved on Saturday May 17, 2014 at 2:39:25 AM Release 9.2 || Microcode 15.3 || Runtime 15.7 || SF 4.41 || LIAR/x86-64 4.118 Edwin 3.116 ;Loading "sicp.scm"... Kill Scheme (y or n)? There are two main issues: The

How do I define a sub environment in scheme?

这一生的挚爱 提交于 2019-12-04 17:31:27
I am just hacking around with Scheme (mit-scheme) and I have just figured out how you change the environment, so that '+' becomes a symbol for the equivalent procedure of the '-' operator. Example (environment-define user-initial-environment '+ -) (eval (+ 3 2) user-initial-environment) => 1 I was just wondering if there were a simple way to deal with environments as variables so when I input an environment into eval, like so (eval <exp> user-initial-environment) I don't have to use 'user-initial-environment'. So I can 'play' with different environments for a function. (eval <exp> env) Where

mit-scheme — run a script and exit

て烟熏妆下的殇ゞ 提交于 2019-12-04 05:40:46
I want to evaluate a script from makefile and exit, like this mit-scheme --load "fact.scm" However, after it evaluates the file, it does not exit, and the repl appears; if I try the (exit) primitive, it asks for confirmation y/n. Is it possible to solve this ? For Unix mit-scheme reads the input files via redirection: mit-scheme < /usr/cph/foo.in > /usr/cph/foo.out 2>&1 & This is taken from the documentation http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-user/Command_002dLine-Options.html#Command_002dLine-Options Charlie Forthmount Just let our command close stdin of the mit

Sublime Text 2 with MIT Scheme

拥有回忆 提交于 2019-12-03 10:14:47
问题 Does anyone know how i could use sublime text 2 with scheme. I've heard ST2 and I want to try it out? right now I'm learning scheme. I have the scheme interpreter installed - I can go to the terminal and type in scheme and run code. I can also run the interpreter in emacs, but emacs isn't really fun. 回答1: It's probably a little bit late but I'd still like to share my experience... Now I'm using Sublime Text 2 and using Scheme fine. First install the package "Scheme" through package control.

mit-scheme REPL with command line history and tab completion

妖精的绣舞 提交于 2019-12-03 03:59:09
问题 I'm reading SICP and I'm using mit-scheme installed on my os x 10.8 laptop via homebrew. Everything works as advertised, however I'm spoiled by the ease with which I get tab completion and command line history in REPL's for runtimes like Python and Node.js. I'm not looking for anything heavy duty, but these features are pretty easy to come by in modern REPL's (it's just a simple startup file in Python and can be implemented in a few lines in Node.js). Is there an easy way to get tab

mit-scheme REPL with command line history and tab completion

岁酱吖の 提交于 2019-12-02 16:19:43
I'm reading SICP and I'm using mit-scheme installed on my os x 10.8 laptop via homebrew . Everything works as advertised, however I'm spoiled by the ease with which I get tab completion and command line history in REPL's for runtimes like Python and Node.js. I'm not looking for anything heavy duty, but these features are pretty easy to come by in modern REPL's (it's just a simple startup file in Python and can be implemented in a few lines in Node.js ). Is there an easy way to get tab completion and command history in the mit-scheme REPL without a heavy-duty application or having to switch to

How to compute the number of times pattern in one list appears in other list in Scheme

北慕城南 提交于 2019-11-29 16:44:31
I am stuck up in a Scheme program for about 5 hours. The program that I am working on should take two lists as input and then compute the number of times the pattern within the first list appears on the second list. For example : > (patt '(b c) '(a b c d e b c)) ==> answer = 2 (patt '(a b c) '(a b c a b c d e a b c c c)) ==> answer = 3 (patt '((a b) c) '(a b (a b) c d e b c)) ==> answer = 1 Below is the code that I have till now. (define (patt lis1 lis2) (cond ((null? lis1) 0) ((null? lis2) 0) [(and (> (length lis1) 1) (eq? (car lis1) (car lis2))) (patt (cdr lis1) (cdr lis2))] ((eq? (car lis1)

How to configure SublimeREPL for mit-scheme?

风格不统一 提交于 2019-11-29 08:38:24
I have installed SublimeREPL, and now I am trying to customize the interpreters a bit. How can I add MIT Scheme to the Tools->SublimeREPL menu? I am new to Sublime Text 2. You can read documentation about configuring additional REPLs here: http://sublimerepl.readthedocs.org/en/latest/#basics-of-language-integration-configuration-and-launch-commands And take a look at existing Scheme configuration here: https://github.com/wuub/SublimeREPL/tree/master/config/Scheme Most Scheme/Lisp dialects are quite easy to configure, you should have no problems whatsoever. Please allow me to share my

How do I execute a .scm script (outside of the REPL) with MIT-Scheme?

怎甘沉沦 提交于 2019-11-28 19:08:37
I want to type something like 'scheme file.scm' and have it interpret the file, and then take me back to my shell, rather than loading it in the REPL. edit: I tried scheme < test.scm and it still uses the REPL, the only difference is that scheme exits when the stream ends. scheme <file.scm should work (as long as you don't specify --interactive and stdin is not a terminal, scheme works non-interactively). To run a scheme program using MIT Scheme: scheme --quiet < program.scm The --quiet option ensures that the output from your program is the only thing that is displayed (i.e. you won't see the

How to install MIT Scheme on Mac?

喜你入骨 提交于 2019-11-28 15:22:29
问题 I want to install MIT Scheme on my Mac, I have downloaded the MacOS X binary(x86-64) . However, I could not make it work using Mac Terminal. I have tried to follow these articles: Installing MIT/GNU Scheme on Mac OS X Leopard Installing MIT Scheme on Mac OS X but it seems out of date and does not work. 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. 回答1: UPDATED FOR EL CAPITAN : The best way that I