Reputation: 305
I am trying to work on the examples of Structure and Interpretation of Classical Mechanics. The book is based on mit-scheme. For some reason the mit-scheme installation is not able to use graphics:
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.
Copyright (C) 2014 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
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
1 ]=>(define win1 (frame 0 7 -2 2))
;Loading "/usr/lib/mit-scheme-x86-64/lib/prx11.so"... aborted
;No graphics types supported.
Upvotes: 2
Views: 640
Reputation: 3042
Just to clarify (even though the github page linked in the OP already has it), you should be using scmutils, and not the ordinary mit-scheme. scmutils includes its own mit-scheme implementation as well as a significant amount of additions designed specifically for the classical mechanics formalism from the book. To install scmutils on macos, make sure to copy the mechanics script to /usr/local/bin and the scmutils folder to /usr/local.
Additionally, scmutils needs a x-window system to run edwin and be able to pop up xdvi to render latex equation. For mac os the best choice is probably Xquartz, which can be installed with brew.
With that installed correctly, plus a working latex (BasicTex for macos works fine) as well as xdvi (can be obtained by doing brew install gv), and assuming your xwindow system is up to date, you should be able to type mechanics
and get into the special scmutils edwin program, which will open in a new X window and not in the current terminal, and you can do (show-expression '(+ x y))
and have xdvi
open to a neatly printed latex expression of "x+y". Additionally, (frame 0 7 -2 2)
also works fine.
I can confirm it works on Mac OS, with Xquartz, BasicTeX and xdvi installed using brew.
Note Edwin is significantly inferior to Emacs, and the above can actually be done from within Emacs on mac os. Make sure to install the latest Emacs, from either brew cask or just google "emacs for mac os". Then, you need to add the following to your .emacs file:
(defun mechanics ()
(interactive)
(let ((root "/usr/local/scmutils/mit-scheme/"))
(run-scheme
(concat root "bin/scheme --library " root "lib"))))
(setenv "PATH"
(concat "/Library/TeX/texbin"
(getenv "PATH")))
The setenv is to let emacs know where xdvi is located; which can be found using which dvi
in terminal. Then in emacs, do M-x mechanics
and you can do (show-expression 'x)
, which will pop up an xdvi window with the expression rendered in latex, as well as (frame 0 7 -2 2)
.
Upvotes: 2