GScheme
A GNUstep-aware scheme interpreter.
Includes many examples, e.g. the sieve of Erathostenes to compute primes, a
Koch curve plotter, mandelbrot set, graphs of various functions etc. GScheme
is fully tail recursive. The garbage collector bypasses GNUstep's
retain/release mechanism in order to deal with circular data structures.
GScheme is document-based and you can edit more than one file at the
same time.
Speed leaves something to be desired as there is a lot of overhead due
to Objective C.
Press Ctrl-Return in the interpreter window to evaluate the last form
that you have entered. This will copy the form to the paste board, so that you
may re-enter it by pressing Alt-V.
Download it
here (TAR).
Special forms implemented include
- define, set!, lambda,
- if, and, or
- begin, apply,
- quote, case, cond,
- let, let, letrec,
- call-with-current-continuation
Primitives implemented include
- +, *, -, /, =, >, <,
- draw-move, draw-line, draw-color,
- sin, cos, sqrt,
- quotient, remainder, not,
- zero?, pair?, number?, eqv?, eq?,
- cons, car, cdr, list, null?,
- set-car!, set-cdr!,
- display, newline
There is a library of additional primitives that are loaded on start-up.
New! As of July 23, 2002:
- make-vector, vector?, list->vector, vector->list?
- vector-length, vector-ref, vector-set! and vector-fill!.
- asin, acos
Examples now include queens.scm, which solves the classic problem and
takes symmetries into account.
New! As of July 31, 2002:
- memory management completely reworked
- browse-environment pops up a window that shows the current
environment (e.g. for environment diagrams); browse.scm shows how
New! As of January 10, 2005:
- memory management simplified
- new UI for browse-environment
- additional primitives: exp, log, tan, atan
- evaluate external files
- more intutive UI e.g. the last form entered is copied to the paste board
and may be repeated by pressing Alt-V
- better error handling
Important: older GNUstep installations may need to replace
#include <GNUstepBase/GSIMap.h>
by
#include <base/GSIMap.h>
at the very beginning of SchemeTypes.m.
New! As of February 17, 2005:
New primitives:
- draw-show produces an image window with the data that have
accumulated and resets the image
- draw-circle draws a circle of a given radius at the current position
without changing the position
- fill-circle is like draw-circle, but fills the circle
- random outputs a random integer in the interval [0, n) when invoked
with an integer "n" and a random double in the interval [0, v) when
invoked with a double "v"
New! As of February 25, 2005:
New primitives, graphical ones come first.
- string-size returns a pair containing the width and height of the
string in the current font
- draw-font sets the current font to a font of a given size
- draw-string draws a string at the current position and advances the
position to just behind the newly drawn string.
There is a demo in "text.scm." You will probably have to change the
font names in the demo to reflect the fonts that you have on your
system e.g. as displayed in the font panel of Ink.app.
Additional primitives:
- string->symbol
- symbol->string
- integer->char
- char->integer
- string-ref
- list->string
- string->list
- make-string
- string-append
- number->string (works for integers in bases between 2 and 36 and decimal floats).
New! As of Mar 2, 2005:
New primitives:
- eval
- string-length
- draw-rect: draws a rectangle of the given width and height at the
current position
- fill-rect: fills the rectangle with the current color.
- format: format a string using the ~a escape etc.
My homepage is
here.
markoriedelde@yahoo.de