summaryrefslogtreecommitdiffstats
path: root/software/scheme.page
blob: 48db68ef948dc302d67760e03a8718d3eba7ad1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
Scheme
==================

``mit-scheme`` with the ``scmutils`` package is assumed; the command 
``mechanics`` starts in interactive edwin prompt. 

See also notes on [The Little Schemer](/books/Little+Schemer/).

Scheme Implementations
-----------------------
Very partial list, mostly just the ones which are interesting to me. 
Alexey Radul maintains a nice table of R5RS implementation details in various
packages on his [website](http://web.mit.edu/~axch/www/scheme/choices.html).

MIT/GNU Scheme
    The 7.9.0 release (last stable as of 01/01/2009) is not R5RS compatible,
    and is generally a pain in the ass to compile on new systems. The 9.0
    release should be easier to compile and distribute because it will use
    a C compiler to bootstrap (true?).

SCM
    SCM is a fairly minimal, very small footprint R5RS-compatible 
    implementation. Apparently very portable and easy to compile. Includes
    the Hobbit compiler. Part of the GNU project, maintained at MIT?

SIOD
    SIOD (scheme in one day) is a super small (75k binary?) Scheme 
    implementation.

Coding in ``edwin``
-----------------------

*Note: this section should be spun off as emacs. edwin is essentially a 
    scheme version of emacs. See this 
    [emacs cheatsheet](http://static.bnewbold.net/mirror/sheets/emacs.pdf)*

Common keyboard commands (usually 'M' is alt button, 'C' is ctrl, and 'S' is 
meta/super/"windows"):

---------   --------------------------------------------------------------------
Shortcut    Effect
---------   --------------------------------------------------------------------
C-x C-f     Open a file, or create a new one

C-x C-s     Save the file

C-x k       Kill (close) a buffer

C-x C-c     Exit the editor

C-g         Abort a command

C-x C-e     Evaluate the previous expression

M-z         Evaluate the surrounding expression

M-o         Evaluate the entire buffer (everything)

C-c C-c     Kill evaluation after an error

C-y         Paste (yank)

C-x 2       Split screen vertically

C-x 5       Split screen horizontally

C-x o       Switch to next buffer window

C-x 1       Return to non-split screen

M-x         Enter a command by name in minibuffer (use tab to complete)

C-x C-b     Show buffer menu

C-x b       Select buffer

C-x u       Undo

C-y         Paste
---------   --------------------------------------------------------------------

Command in ``.edwin`` to set Super-TAB to autocomplete scheme variables::

    (define-key 'Scheme #\s-tab 'scheme-complete-variable)

Scope
--------------
``set!`` looks up a symbol name and permanently changes the first value it comes
across. ``let`` (and ``letrec``) create a new symbol with the given value.
But wait, you need a ``lambda`` block to make everything work?

Environment/Interpreter Commands
-----------------------------------
``(disk-save filename)`` will save a binary microcode image; an existing 
image can be specified with the ``--band`` option at runtime or with
``(disk-restore filename)`` from within the interpreter. Bands are also called
worlds.

"First Class"
------------------
"Procedures as first class objects" is one of the features commonly attributed
to scheme. What does that mean? SICP describes first class objects as those
that can be: named by variables, passed as arguments, returned as results,
and included in data structures.