Reference

s9sc(1)

NAME

s9sc - Scheme 9 Scientific Calculator

USAGE

s9sc [-h?] [-gnqv] [-m size[m]] [-f program] [-d image] [-i]

DESCRIPTION

The Scheme 9 Scientific Calculator is an extended R4RS Scheme interpreter containing some extra procedures for curve plotting and low-level vector graphics on X11 displays. The s9sc command starts the interpreter. See the s9(1) man page for command line options.

THE CANVAS

The S9SC canvas has a virtual size of 13333 times 10000 pixels, which is transparently mapped to whatever resolution the real X11 real window has. The (0,0) coordinate is at the lower left corner of the window. The canvas is white and figures can be drawn in black or white color.

PROCEDURES

Initialization and Shutdown

(sc:init) ==> unspecific
Initialize the Scientific Calculator package. Load the default font and open an X11 window for displaying vector graphics. This is automatically done when S9SC starts, so this procedure only has to be called to re-initialize the package after shutting it down with sc:fini.

(sc:fini) ==> unspecific Shut down the Scientific Calculator. Close the X11 window used for displaying vector graphics. After shutting down the package calling any S9SC procedure will yield an undefined result.

Vector Graphics

(box int1 int2 int3 int3 bool1 bool2) ==> unspecific Draw a box with the lower left corner at (int1,int2) and the upper right corner at (int3,int4). When bool1 is #t, draw the box with black ink and else erase it (draw it with white ink). When bool2 is #t, fill the box, else draw just an outline.

(clear) ==> unspecific Clear the canvas.

(ellipse int1 int2 int3 int3 bool1 bool2) ==> unspecific Draw an ellipse touching the four edges of an imaginary box with the lower left corner at (int1,int2) and the upper right corner at (int3,int4). When bool1 is #t, draw the ellipse with black ink and else erase it (draw it with white ink). When bool2 is #t, fill the ellipse, else draw just an outline.

(line int1 int2 int3 int3 bool) ==> unspecific Draw a straight line from (int1,int2) to (int3,int4). When bool is #t, draw the line with black ink and else erase it (draw it with white ink).

(put-string int1 int2 int3 bool string) ==> unspecific Write the text contained in string to the canvas. The lower left corner of the imaginary box enclosing the text will be at (int1,int2). Int3 specifies a scaling factor for increasing the text size. Valid values range from 1 (no magnification) to 10 (large text). When bool is #t, write the text with black ink and else erase it (write it with white ink).
Note: Non-printable ASCII characters and non-ASCII characters will print as blanks.

(string-height string integer) ==> integer Return the height in virtual pixels of the given string when printed with a scaling factor of integer.

(string-width string integer) ==> integer Return the width in virtual pixels of the given string when printed with a scaling factor of integer.

(write-canvas string) ==> unspecific Write an embedded Postscript representation (an ``EPS file'') of the complete canvas to the file specified in string. No external resources are required by the resulting file. When the given file exists, an error is reported.

Curve Plotting

(setup real1 real2 real3 real4 option ...) ==> unspecific Set up a visual Cartesian coordinate system ranging from real1 to real2 on the X-axis and from real3 to real4 on the Y-axis. Ticks and labels will be printed on both axes by default. Neither real1 nor real3 may be positive. The following options may be passed to setup:

x-grid: boolean (default: #f)
y-grid: boolean (default: #f) Whether or not to draw a visual grid on the X/Y-axis.
x-labels: boolean (default: #t)
y-labels: boolean (default: #t) Whether or not to draw labels next to ticks.
x-lstep: integer (default: 1)
y-lstep: integer (default: 1) Print a label next to every integer'th tick.
x-step: real (default: X-range/20)
y-step: real (default: Y-range/20) The distance between two ticks on the X/Y-axis.
x-ticks: boolean (default: #t)
y-ticks: boolean (default: #t) Whether or not to draw ticks on the X/Y-axis.

Both the X and Y parts of an option can be set by omitting the x- or y- prefix, e.g.: grid: sets x-grid: and y-grid: at once.

Example:
(setup -1 1 -1 1 step: 0.05 lstep: 2 grid: #t)

(plot procedure option ...) ==> unspecific
(plot list option ...) ==> unspecific Plot the function computed by procedure or the set contained in list. The setup procedure must be used to establish a coordinate system before plotting a function or set. For automatic plotting, see plot* below. X-values that are not in the domain of a function will not plot, so the following example will work fine:

(setup -1 1 -10 10)
(plot /)

The following options may be passed to plot:

from: real (default: beginning of X-range) Leftmost X-coordinate to plot.
to: real (default: end of X-range) Rightmost X-coordinate to plot.
spread: boolean (default: #f) When setting spread: #t while plotting a set, the items of the set will be spread so that they fill the range of the X-axis completely. When the X-axis is shorter than the size of the set, the set will be compressed (which will result in a loss of items). Spread: has no effect when plotting functions.
res: integer (default: 100) The number of points to be plotted.
type: line | scatter | pin | bar (default: line) The kind of rendering to be used. Line will plot a smooth line, scatter will draw individual dots. pin will print vertical lines from the X-axis to the corresponding Y-value, and bar will print solid bars instead of pins.
style: 0..4 (default: 0)
Use a specific style in bar and scatter plots. In bar plots, style 0 renders empty boxes and larger values fill the boxes with darker scales of gray. In scatter plots, 0=white squares, 1=black squares, 2=white circles, 3=black circles, 4=crosses.

(plot* int1 int2 procedure option ...) ==> unspecific
(plot* int1 int2 list option ...) ==> unspecific Like plot, this procedure plots a function or set, but it computes the range of the Y-axis automatically, so no coordinate system has to be set up prior to calling plot*. Int1 and int2 specify the beginning and end of the X-axis. When a coordinate system was set up before, plot* will erase it and set up a new one. Plot* supports the same options as plot.

(caption (integer1 string1) ...) ==> unspecific Display a box containing the caption explaining multiple plot styles used in a single diagram. Currently the caption can only be used in combination with scatter plots. Each integer in a two-element list passed to caption represents a style (0..4) and the associated string contains the description for the corresponding style.

SEE ALSO

s9(1)

AUTHOR

Nils M Holm < nmh at t3x.org >