Functional Problem Solving (CSC 151 2016S) : Reference

Scheme Procedures A-Z


Symbols

(= num1 num2)
Standard Numeric Procedure. Determines if num1 is equal to num2
(< num1 num2 ...numn)
Standard Numeric Procedure. Determines if num1 is strictly less than num2, and num2 is strictly less than num3 and so forth.
(<= num1 num2 ...numn)
Standard Numeric Procedure. Determines if num1 is less than or equal to num2, and num2 is less than or equal to num3 and so forth.
(> num1 num2 ...numn)
Standard Numeric Procedure. Determines if num1 is strictly greater than num2, and num2 is strictly greater than num3 and so forth.
(>= num1 num2 ...numn)
Standard Numeric Procedure. Determines if num1 is greater than or equal to num2, and num2 is greater than or equal to num3 and so forth.
(^and f1 f2 ... fn)
Traditional Higher-Order Procedure. A higher-order version of and. Creates a new procedure that, when applied to some values, returns (and (f1 values) (f2 values) ... (fn values)).
(^not pred?)
Traditional Higher-Order Procedure. A higher-order version of not. Creates a new procedure, that, when applied to some values, returns the opposite of pred?. That is, (1) if pred? returns a truish value when applied to some parameters, the new procedure returns #f when applied to those same parameters; (2) if pred? returns false when applied to some parameters, the new procedure returns #t when applied to those same parameters.
(^or f1 f2 ... fn)
Traditional Higher-Order Procedure. A higher-order version of or. Creates a new procedure that, when applied to some values, returns (or (f1 values) (f2 values) ... (fn values)).

A

(abs num)
Standard Scheme Procedure. Compute the absolute value of num.
(and exp1 exp2 ... expn)
Standard keyword. Evaluate each expression in turn. If any of those values is false, return false. Otherwise, return the value of the last expression.
(append lst_0 lst_1 ... lst_n)
Standard List Procedure. Create a new list by concatenating the elements of lst_0, lst_1, ... lst_n.

C

(caar lst)
Standard List Procedure. If lst's first element is a list, gets the first element of that first element, the the car of the car of lst. If lst is not a list, or its first element is not a list, reports an error.
(cadr lst)
Standard List Procedure. Get the second element of lst, the car of the cdr of lst
(caddr lst)
Standard List Procedure. Get the third element of lst, the car of the cdr of the cdr of lst.
(car lst)
Standard List Procedure. Get the first element of lst.
(cdr lst)
Standard List Procedure. Get a list the same as lst but without the first element.
(ceiling num)
Standard Scheme Procedure. Find the smallest integer greater than or equal to num. That is, round up.
(char? val)
Standard Character Predicate. Determine if val is a character.
(char->integer ch)
Standard Character Procedure. Get ch's position in the collating sequence.
(char<? ch1 ch2)
Standard Character Comparator. Determine if ch1 precedes ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char<=? ch1 ch2)
Standard Character Comparator. Determine if ch1 equals ch2 or if ch1 precedes ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char=? ch1 ch2)
Standard Character Comparator. Determine if ch1 and ch2 are the same. Both ch1 and ch2 must be characters.
(char>=? ch1 ch2)
Standard Character Comparator. Determine if ch1 and ch2 are equal or if ch1 follows ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char>? ch1 ch2)
Standard Character Comparator. Determine if ch1 follows ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char-alphabetic? ch)
Standard Character Predicate. Determine if ch (which must be a character) is an alphabetic character (in English, #\a, #\b, ... #\z, #\A, #\B, ...., #\Z).
(char-ci<? ch1 ch2)
Standard Character Comparator. If both ch1 and ch2 are alphabetic characters (letters), determine if ch1 naturally precedes ch2, ignoring case. If either is not alphabetic, determine if ch1 precedes ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char-ci<=? ch1 ch2)
Standard Character Comparator. If both ch1 and ch2 are alphabetic characters (letters), determine if ch1 naturally precedes or equals ch2, ignoring case. If either is not alphabetic, determine if ch1 equals ch2 or if ch1 precedes ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char-ci=? ch1 ch2)
Standard Character Comparator. If both ch1 and ch2 are alphabetic characters (letters), determine if ch1 and ch2 represent the same letter, ignoring case. If either is not alphabetic, determine if ch1 follows ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char-ci>=? ch1 ch2)
Standard Character Comparator. If both ch1 and ch2 are alphabetic characters (letters), determine if ch1 naturally follows or equals ch2, ignoring case. If either is not alphabetic, determine if ch1 equals ch2 or if ch1 follows ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char-ci>? ch1 ch2)
Standard Character Comparator. If both ch1 and ch2 are alphabetic characters (letters), determine if ch1 naturally follows ch2, ignoring case. If either is not alphabetic, determine if ch1 follows ch2 in the collating sequence. Both ch1 and ch2 must be characters.
(char-downcase ch)
Standard Character Procedure. If ch is an upper-case character (#\A, #\B, ... #\Z, in ASCII; potentially other characters in other character sets), return the corresponding lower-case character. Otherwise, return the same character.
(char-lower-case? ch)
Standard Character Predicate. Determine if ch (which must be a character) represents a lower-case character (in English, #\a, #\b, ... #\z).
(char-upper-case? ch)
Standard Character Predicate. Determine if ch (which must be a character) represents an upper-case character (in English, #\A, #\B, ... #\Z).
(char-numeric? ch)
Standard Character Predicate. Determine if ch (which must be a character) represents a digit in a number (traditionally, #\0, #\1, ... #\9, although other systems have different numeric characters).
(char-upcase ch)
Standard Character Procedure. If ch is a lower-case character (#\a, #\b, ... #\z, in ASCII; potentially other characters in other character sets), return the corresponding upper-case character (#\A for #\a, #\B for #\b, etc.). Otherwise, return the same character.
(char-whitespace? ch)
Standard Character Predicate. Determine if ch (which must be a character) represents a whitespace character, such as a space, a tab, or a newline.
(check-= expression expected epsilon) , (check-= expression expected epsilon optional-message)
RackUnit procedure. Evaluate expression and expected and then compare them for numeric equality (within epsilon). If they are equal, do nothing. If they are not equal, print an error message. If the optional message is included, also print that message.
(check-equal? expression expected) , (check-equal? expression expected optional-message)
RackUnit procedure. Evaluate expression and expected and then compare them for equality. If they are equal, do nothing. If they are not equal, print an error message. If the optional message is included, also print that message.
(check-not-equal? expression expected) , (check-not-equal? expression expected optional-message)
RackUnit procedure. Evaluate expression and expected and then compare them. If they are not equal, do nothing. If they are equal, print an error message. If the optional message is included, also print that message.
(check-true expression) , (check-true expression optional-message)
RackUnit procedure. Evaluate expression and determine whether it is true (#t). If so, do nothing. If not, print an error message. If the optional message is included, also print that message.
(close-input-port input-port)
Standard File Procedure. Close an open input port. (It is an error to try to close something that is not an input port, or an input port that is already closed.)
(close-input-port input-port)
Standard File Procedure. Close an open input port. (It is an error to try to close something that is not an input port, or an input port that is already closed.)
(close-output-port output-port)
Standard File Procedure. Close an open output port. (It is an error to try to close something that is not an output port, or an output port that is already closed.)
(color? val)
MediaScheme Color Procedure. Checks to see if val is one of the various valid forms of colors (integer encoded RGB colors, color names, HSV lists, etc.).
(color->color-name string)
MediaScheme Color Procedure. Convert any of the myriad representations of colors to a string that names a similar color. Note that this conversion approximates the color as there are many fewer names than colors.
(color->hsv color)
MediaScheme Color Procedure. Convert any of the myriad representations of colors to a corresponding HSV (hue, saturation, value) representation.
(color->irgb string)
MediaScheme Color Procedure. Convert any of the myriad representations of colors to a corresponding integer-encoded RGB color.
(color->rgb-list color)
MediaScheme Color Procedure. Convert the given color to a list of its three components (red, green, and blue).
(color->string color)
MediaScheme Color Procedure. Convert the given color to a component string that is comparatively easy for a novice to read. Warning! That string cannot be used as a color.
(color-grid box-width box-height columns color_0 ... color_n)
Mediascheme Color Procedure. Create a grid of colors with the specified number of columns. Fills in the gird using the specified list of colors. Each box in the grid has the specified width and height. If the number of colors is not a multiple of the number of columns, the remaining boxes are the background color.
(color-name? val)
MediaScheme Color Procedure. Checks to see if val is a string representing a color in the database of colors.
(color-name->irgb string)
MediaScheme Color Procedure. Get the integer-encoded RGB color that corresponds to the given color name.
(color-representation color)
MediaScheme Color Procedure. Determine what color representation is used for the the given color. That representation is returned as a symbol. If the value does not appear to be a color, returns #f.
(color-swatch color1) , (color-swatch color1 color2) , (color-swatch color1 color2 color3 ...)
MediaScheme Color Procedure. Create an small image (“swatch”) that shows the given colors. Permits up to six colors.
(complex? val)
Optional Scheme Procedure. Determine whether val can be interpreted as a complex number.
(compose f g)
Traditional Higher-Order Procedure. Build a one-parameter procedure that applies g to its parameter, and then f to that result. ((compose f g) x) is the same as (f (g x)).
(compose f1 f2 ... fn-1 fn)
Traditional Higher-Order Procedure. Build a one-parameter procedure that applies each f, in turn, starting with fn and working backwards. The composition, when applied to a value, x, produces the same result as (f1 (f2 (... (fn-1 (fn x))))). We will sometimes write compose as o.
(cons value lst)
Standard List Procedure. Create a new list by prepending value to the front of lst.
(constant value)
Traditional Higher-Order Procedure. Create a new function that always returns value, no matter what parameters it is applied to.
(context-get-bgcolor)
MediaScheme GIMP Procedure. Returns GIMP's current background color (as an RGB color).
(context-get-brush)
MediaScheme GIMP Procedure. Get GIMP's active brush.
(context-get-color-names)
MediaScheme GIMP Procedure. Get a vector of all the available color names.
(context-get-fgcolor)
MediaScheme GIMP Procedure. Returns GIMP's current foreground color (as an RGB color).
(context-list-brushes)
MediaScheme GIMP Procedure. List all valid brush names.
(context-list-brushes pattern)
MediaScheme GIMP Procedure. List all the valid brush names that contain pattern.
(context-list-colors)
MediaScheme GIMP Procedure. List all valid color names.
(context-list-colors pattern)
MediaScheme GIMP Procedure. List all the valid color names that contain pattern.
(context-list-fonts)
MediaScheme GIMP Procedure. List all valid font names.
(context-list-fonts pattern)
MediaScheme GIMP Procedure. List all the available font names that contain pattern.
(context-set-bgcolor! color)
MediaScheme GIMP Procedure. Sets GIMP's current background color to color.
(context-set-brush! brush-name) , (context-set-brush! brush-name brush-size)
MediaScheme GIMP Procedure. Sets GIMP's current brush to brush-name. If the brush-size is specified, also sets the size of brush. Only works for selected brushes (typically, those that start with a number, like "2. Hardness 100").
(context-set-fgcolor! color)
MediaScheme GIMP Procedure. Sets GIMP's current foreground color to color.
(context-update-displays!)
MediaScheme GIMP Procedure. Update all of the displays to show changes to images.

D

(delete-file filename)
Common File Procedure. Delete the file specified by filename. If the file doesn't exist, reports an error.
(display value)
Standard I/O Procedure. Print a human-readable representation of value on the screen.
(display value output-port)
Standard File Procedure. Print a human-readable representation of value on the specified port.
(drawing? value)
MediaScheme Drawing Procedure. Determine if value can be interpreted as a drawing.
drawing-blank
MediaScheme Drawing Constant. An empty drawing. Included for the sake of completeness. Also provides a useful base case for recursion over grouped drawings.
(drawing-blank? value)
MediaScheme Drawing Procedure. Determine if value can be interpreted as a blank drawing.
(drawing-bottom drawing)
MediaScheme Drawing Procedure. Determine the row of the bottom edge of a drawing.
(drawing-color drawing)
MediaScheme Drawing Procedure. Determine the color of a simple drawing. (Does not work for compound drawings.)
(drawing-compose list-of-drawings)
MediaScheme Drawing Procedure. Create a new drawing by overlaying all of individual drawings in list-of-drawings. Note that the drawings are stacked first to last, so the first drawing in the list is at the bottom and the last in the list is at the top.
(drawing-group drawing1 drawing2 ... drawingn)
MediaScheme Drawing Procedure. Create a new drawing by overlaying all of the individual drawings. Note that the drawings are stacked first to last, so drawing1 is at the bottom and drawingn is at the top.
(drawing-height drawing)
MediaScheme Drawing Procedure. Determine the approximate height of a drawing.
(drawing-hscale drawing factor)
MediaScheme Drawing Procedure. Creates a new drawing by horizontally scaling drawing by factor. Note that every part of the drawing is scaled horizontally, including the horizontal distance of each component of the drawing from the origin.
(drawing-hshift drawing amt)
MediaScheme Drawing Procedure. Creates a new drawing by shifting drawing horizontally by factor. If factor is positive, the drawing is shifted to the right. If factor is negative, the drawing is shifted left by the absolute value of factor.
(drawing-left drawing)
MediaScheme Drawing Procedure. Determine the column of the left edge of a drawing.
(drawing-outline drawing brush)
MediaScheme Drawing Procedure. Creates a new drawing by outlining each element in drawing with brush. Element colors are preserved. After outlining, no elements of the resulting drawing are filled.
(drawing-recolor drawing color)
MediaScheme Drawing Procedure. Creates a new drawing by recoloring drawing in color. Note that even if drawing contained colors, the new drawing contains only a single color.
(drawing-render! drawing image)
MediaScheme Drawing Procedure. Render drawing on the specified image, thereby changing the image. Expects that at least part of the drawing fits within the confines of the image.
(drawing-right drawing)
MediaScheme Drawing Procedure. Determine the column of the right edge of a drawing.
(drawing-scale drawing factor)
MediaScheme Drawing Procedure. Creates a new drawing by scaling drawing by factor. Note that every part of the drawing is scaled, including both the horizontal and vertical distance of each component of the drawing from the origin.
(drawing->image drawing width height)
MediaScheme Drawing Procedure. Create a new image of the specified width and height that contains the portion of drawing that fits in the rectangular region bounded on the left by 0, on the top by 0, on the right by width-1 and on the bottom by height-1.
(drawing-top drawing)
MediaScheme Drawing Procedure. Determine the row of the top edge of a drawing.
(drawing-type drawing)
MediaScheme Drawing Procedure. Determine the type of drawing represented. Returns a symbol: ellipse for ellipses and circles, rectangle for rectangles and squares, group for grouped drawings, and line for lines (not yet supported).
drawing-unit-circle
MediaScheme Drawing Constant. A unit circle. That is, a circle with diameter 1, filled in black, centered at (0,0).
drawing-unit-square
MediaScheme Drawing Constant. A unit square. That is, a square with edge-length 1, filled in black, centered at (0,0).
(drawing-vscale drawing factor)
MediaScheme Drawing Procedure. Creates a new drawing by vertically scaling drawing by factor. Note that every part of the drawing is scaled vertically, including the vertical distance of each component of the drawing from the origin.
(drawing-vshift drawing amt)
MediaScheme Drawing Procedure. Creates a new drawing by shifting drawing vertically by factor. If factor is positive, the drawing is shifted downward. If factor is negative, the drawing is shifted upward by the absolute value of factor.
(drawing-width drawing)
MediaScheme Drawing Procedure. Determine the width of a drawing.

E

(eof-object? val)
Standard File Procedure. Determine if val is something returned by read (or read-char or peek-char) to indicate the end of input.
(error message)
Standard Procedure. Print the message (which is typically a string) and then stop the computation currently underway.
(error message val1 ... valn)
Standard Procedure. Print the message (which is typically a string) and all of the values. Then stop the computation currently in progress.
(even? int)
Standard Scheme Procedure. Determine whether the integer value int is even (that is, has a remainder of 0 when divided by 2).
(exact? num)
Standard Scheme Procedure. Determine whether the numeric value num is represented exactly (that is, not approximated).
(exact->inexact num)
Standard Scheme Procedure. Create an inexact representation of num.
(expt base power)
Standard Scheme Procedure. Compute basepower.

F

(file-exists? filename)
Standard File Procedure. Determine whether a file with the given name exists.
(filter pred? lst)
Traditional List Procedure. Select the elements of lst for which pred? holds. (filter means to “filter in”, not to “filter out”.)
(floor num)
Standard Scheme Procedure. Find the largest integer less than or equal to num. That is, round down.
(for-each proc! lst)
Standard Higher-Order List Procedure. Apply proc! to each element of the given list. Called primarily for side effects.

H

(hscale-drawing factor drawing)
MediaScheme Drawing Procedure. Creates a new drawing by horizontally scaling drawing by factor. Note that every part of the drawing is scaled horizontally, including the horizontal distance of each component of the drawing from the origin.
(hshift-drawing amt drawing)
MediaScheme Drawing Procedure. Creates a new drawing by shifting drawing horizontally by factor. If factor is positive, the drawing is shifted to the right. If factor is negative, the drawing is shifted left by the absolute value of factor.

I

(if test consequent alternative)
Standard keyword. Evaluate test. If its value is truish (that is, anything but false), evaluate consequent and return its value. If the value of test is false (#f), evaluate and return alternative.
(image? val)
MediaScheme GIMP Procedure. Determine if val is an image.
(image-airbrush-line! image pressure col1 row1 col2 row2)
MediaScheme GIMP Procedure. Draw a line in image from (col1,row1) to (col2,row2). Uses the airbrush and foreground color. The pressure should be between 0 and 100 (inclusive).
(image-blot! image col row)
MediaScheme GIMP Procedure. Draw a spot in image at (col,row) with the current brush and foreground color.
(image-compute pos2color width height)
MediaScript GIMP Procedure. Create a new width-by-height image by using pos2color (a function of the form (lambda (col row) color)) to compute the color at each position in the image.
(image-copy-paste-block! source source-col source-row target target-col target-row width height)
MediaScheme GIMP Procedure. Copy a width-by-height region from source to target. The (col,row) pairs specify the top-left corner of the region in each image.
(image-draw-line! image col1 row1 col2 row2)
MediaScheme GIMP Procedure. Draw a line in image from (col1,row1) to (col2,row2). Uses the current brush and foreground color.
(image-fill-selection! image)
MediaScheme GIMP Procedure. Fill the selected region of the given image with the current foreground color.
(image-get-pixel image column row)
MediaScheme GIMP Procedure. Get the pixel at the specified position in the image.
(image-height image)
MediaScheme GIMP Procedure. Determine the height of the given image
(image-load filename)
MediaScheme GIMP Procedure. Load an image from a file. The name of the file is a string (and, unless a named value, typically surrounded by quotation marks).
(image-new width height)
MediaScheme GIMP Procedure. Create a new image of specified width and height.
(image-recompute! image fun)
MediaScheme GIMP Procedure. Scans through the image, replacing the color at each pixel in the selected region (or the whole image, if nothing is selected) with the result of applying fun to the column and row of the pixel. fun should therefore have the form (lambda (col row) color). If fun returns IRGB-TRANSPARENT, leaves the pixel unchanged.
(image-redo! image fun)
MediaScheme GIMP Procedure. Scans through the image, replacing the color at each pixel in the selected region (or the whole image, if nothing is selected) with the result of applying fun to the column, row, and current color at each position. fun should therefore have the form (lambda (col row color) newcolor). If fun returns IRGB-TRANSPARENT, leaves the pixel unchanged.
(image-refresh-display! image)
MediaScheme GIMP Procedure. Refreshes the display of the given image. (While context-update-displays! should update displays, it doesn't always work. This procedure forces an update. And it still doesn't always work. Doing a new call to image-show seems to refresh all copies of the image.)
(image-save image fname)
MediaScheme GIMP Procedure. Save image in the specified file (which should provide the full path to the file). The type of the image (JPEG, GIF, PNG, etc.) is determined by the suffix of the file name.
(image-select-all! image)
MediaScheme GIMP Procedure. Selects all of the pixels in the image.
(image-select-ellipse! image selection-type left top width height)
MediaScheme GIMP Procedure. Select an ellipse whose left margin is left, top margin is top, width is width and height is height. If selection-type is REPLACE, the ellipse replaces the current selection. If selection-type is ADD, the ellipse is added to the current selection. If selection-type is SUBTRACT, the ellipse is subtracted from the current selection. If selection-type is INTERSECT, the ellipse is intersected with the current selection (that is, only points that are in both the current selection and the ellipse remain selected).
(image-select-inverse! image)
MediaScheme GIMP Procedure. Selects the inverse of all selected images in the image.
(image-select-nothing! image)
MediaScheme GIMP Procedure. Clears the current selection. Afterwards, nothing is selected.
(image-select-polygon! image selection-type positions)
MediaScheme GIMP Procedure. Select a polygon described by the given list of positions (each created by position-new). If selection-type is REPLACE, the polygon replaces the current selection. If selection-type is ADD, the polygon is added to the current selection. If selection-type is SUBTRACT, the polygon is subtracted from the current selection. If selection-type is INTERSECT, the polygon is intersected with the current selection (that is, only points that are in both the current selection and the polygon remain selected).
(image-select-rectangle! image selection-type left top width height)
MediaScheme GIMP Procedure. Select an rectangle whose left margin is left, top margin is top, width is width and height is height. If selection-type is REPLACE, the rectangle replaces the current selection. If selection-type is ADD, the rectangle is added to the current selection. If selection-type is SUBTRACT, the rectangle is subtracted from the current selection. If selection-type is INTERSECT, the rectangle is intersected with the current selection (that is, only points that are in both the current selection and the rectangle remain selected).
(image-set-pixel! image column row rgb-color)
MediaScheme GIMP Procedure. Set the pixel at the specified position to the new color.
(image-show image)
MediaScheme GIMP Procedure. Opens a new window with the image.
(image-stroke-selection! image)
MediaScheme GIMP Procedure. Traces the edge of the selected region of the given image with the current brush and foreground color.
(image-transform! image fun)
MediaScheme GIMP Procedure. Transform image in place by setting each pixel to the result of applying fun to that current pixel color.
(image-transform-pixel! image column row func)
MediaScheme GIMP Procedure. Modify the pixel at (col,row) in image by applying func to its old color and setting that pixel to the resulting color.
(image-variant image fun)
MediaScheme GIMP Procedure. Create a new image of the same width and height as image, each of whose pixels is computed by applying fun to the color of the corresponding pixel in image.
(image-width image)
MediaScheme GIMP Procedure. Determine the width of the given image.
(inexact? num)
Standard Scheme Procedure. Determine whether the numeric value num is represented inexactly (that is, approximated).
(inexact->exact num)
Standard Scheme Procedure. Create an exact representation of num. (Of course, if num was already approximated, the result, while exact, still approximates whatever num approximated.)
(input-port? val)
Standard File Predicate. Determine if val is an open input port.
(integer? val)
Standard Scheme Procedure. Determine whether val is an integer.
(integer->char n)
Standard Character Procedure. Get the nth character in the collating sequence.
(irgb r g b)
MediaScheme Color Procedure. Build an integer-encoded RGB color whose red, green, and blue components are the specified values, each of which is an integer between 0 and 255, inclusive. If given real values, rounds them to the nearest integer. If given values outside the bouds, caps them at the bounds.
(irgb? value)
MediaScheme Color Predicate. Determine if value can be interpreted as an integer-encoded RGB color. Warning! Almost any integer can be interpreted as an integer-encoded RGB color.
(irgb->color-name irgb-color)
MediaScheme Color Procedure. Convert the given integer-encoded RGB color to a string that names a similar color. Note that this conversion approximates the RGB color as there are many fewer names than colors.
(irgb->hsv irgb-color)
MediaScheme Color Procedure. Convert the given integer-encoded RGB color to a list corresponding to the HSV (hue, saturation, value) representaiton.
(irgb->rgb-list irgb-color)
MediaScheme Color Procedure. Convert the given color to a list of its three components.
(irgb->string irgb-color)
MediaScheme Color Procedure. Convert the given RGB color to an easy-to-read string. (The string is not so easy to convert back to an RGB color.)
(irgb-add irgb-color-1 irgb-color-2)
MediaScheme Color Procedure. Add the corresponding RGB components of irgb-color-1 and irgb-color-2. If any component sum is greater than 255, uses 255 for the resulting component.
(irgb-average irgb-color-1 irgb-color-2)
MediaScheme Color Procedure. Average the corresponding RGB components of irgb-color-1 and irgb-color-2.
(irgb-bluer irgb-color)
MediaScheme Color Procedure. Build a bluer version of the given color.
(irgb-blue irgb-color)
MediaScheme Color Procedure. Get the blue component of an integer-encoded RGB color.
(irgb-complement irgb-color)
MediaScheme Color Procedure. Compute the psuedo-complement of the given color.
(irgb-darker irgb-color)
MediaScheme Color Procedure. Build a darker version of the given color.
(irgb-greener irgb-color)
MediaScheme Color Procedure. Build a greener version of the given color.
(irgb-green color)
MediaScheme Color Procedure. Get the green component of an integer-encoded RGB color.
(irgb-lighter irgb-color)
MediaScheme Color Procedure. Build a lighter version of the given color.
(rgb-list->irgb rgb-lst)
MediaScheme Color Procedure. Converts a list representation of a color of the form (r g b) into an integer-encoded RGB color.
(irgb-new r g b)
MediaScheme Color Procedure. Build an integer-encoded RGB color whose red, green, and blue components are the specified values, each of which is an integer between 0 and 255, inclusive. If given real values, rounds them to the nearest integer. If given values outside the bouds, caps them at the bounds.
(irgb-phaseshift irgb-color)
MediaScheme Color Procedure.Phase shift” the color by adding 128 to components less than 128 and subtracting 128 from components greater than 128.
(irgb-redder irgb-color)
MediaScheme Color Procedure Build a redder version of the given color.
(irgb-red irgb-color)
MediaScheme Color Procedure. Get the red component of an integer-encoded RGB color.
(irgb-rotate irgb-color)
MediaScheme Color Procedure. Rotate the three components of the given color, setting the red component to the value of the green component, the green component to the value of the blue component, and blue compnent to the value of the red component.
(irgb-subtract irgb-color-1 irgb-color-2)
MediaScheme Color Procedure. Subtract the RGB components of irgb-color-2 from the corresponding components of irgb-color-1. If any component difference is less than 0, uses 0 for the resulting component.

L

(lambda (params) expression1 ... expressionn)
Standard Keyword. A procedure which takes as input the names listed in params, does the computation indicated by the expressions, and returns the value of the last expression.
(left-section binproc left)
Traditional Higher-Order Procedure. Given a two-parameter procedure and a value, creates a new anonymous one-parameter procedure by filling in the first (left) parameter of the procedure. The new procedure, when applied to a value, v, returns (binproc left v).
(list val_0 val_1 ... val_n)
Standard List Procedure. Create a new list of size n+1 of the form (val_0 val_1 ... val_n).
(list->string char-list)
Standard String Procedure. Convert char-list (which must be a list of characters) to a string. The ith element of the list becomes the ith character in the string.
(list->vector lst)
Standard Vector Procedure. Convert lst to a vector so that the ith value in the vector is the same as the ith value in the lst.
(list-drop lst n)
List Procedure. Build a new list that consists of all but the first n elements of lst.
(list-ref lst n)
Standard List Procedure. Get the nth element of lst. Note that elements are numbered starting at 0.
(list-take lst n)
List Procedure. Build a new list that consists of the first n elements of lst.
(l-s binproc left)
Traditional Higher-Order Procedure. A shorthand for left-section.

M

(make-list n val)
Customary List Procedure. Make a new list that consists of n copies of val.
(make-string length ch)
Standard String Procedure. Create a new string of length length, containing only copies of ch.
(make-vector length val)
Standard Vector Procedure. Create a new vector of length length, containing only copies of val.
(map func lst)
Standard Higher-Order List Procedure. Create a new list, each of whose elements is computed by applying func to the corresponding element of lst.
(max v1 v2)
Standard Scheme Procedure. Find the larger of v1 and v2.
(max v1 v2 ... vn)
Standard Scheme Procedure. Find the largest of v1 through vn.
(member val lst)
Standard List Procedure. Determine if val appears in lst. If so, returns the sublist that starts with val. If not, returns false (#f).
(member? val lst)
MediaScheme List Procedure. Determine if val appears in lst. If so, returns true (#t). If not, returns false (#f).
(min v1 v2)
Standard Scheme Procedure. Find the smaller of v1 and v2.
(min v1 v2 ... vn)
Standard Scheme Procedure. Find the smallest of v1 through vn.
(modulo value modulus)
Standard Scheme Procedure. In a number line segmented into modulus-sized sections, gives the offset of value from the start of its section.

N

(negative? num)
Standard Scheme Procedure. Determine whether the numeric value num is negative (less than zero).
(newline)
Standard I/O Procedure. Write a newline (carriage return) to the screen.
(newline output-port)
Standard File Procedure. Write a newline (carriage return) to the specified output port.
(null? lst)
Standard list predicate. Checks if lst is the empty list.
null
Standard list constant. The empty list.
(number? val)
Standard Scheme Procedure. Determine if val is a number.
(number->string num)
Standard String Procedure. Convert num to an appropriate textual representation.

O

(o f1 f2 ... fn-1 fn)
Traditional Higher-Order Procedure. Build a one-parameter procedure that applies each f, in turn, starting with fn and working backwards. The composition, when applied to a value, x, produces the same result as (f1 (f2 (... (fn-1 (fn x))))).
(odd? int)
Standard Scheme Procedure. Determine whether the integer value int is odd (that is, has a remainder of 1 when divided by 2).
(open-input-file filename)
Standard File Procedure. Open the specified file for reading. Returns an input port.
(open-output-file filename)
Standard File Procedure. Open the specified file for writing. Returns an output port.
(or exp1 exp2 ... expn)
Standard keyword. Evaluate each expression in turn. If any of those values is true, return true. Otherwise, return the value of the last expression.
(output-port? val)
Standard File Predicate. Determine if val is an open output port.

P

(peek-char)
Standard I/O Procedure. Determine the next character available from the keyboard (or other standard input port), but do not read over it.
(peek-char input-port)
Standard File Procedure. Determine the next character available on the specified port. If no characters remain, returns the end-of-file object.
(point col row)
MediaScheme Point Procedure. Build a new value that represents the point at (col,row).
(point? value)
MediaScheme Point Procedure. Determine if value is a point (or can be interpreted as such).
(point-col p)
MediaScheme Point Procedure. Extract the column (x value) of point p.
(point-distance p1 p2)
MediaScheme Point Procedure. Compute the distance between p1 and p2.
(point-interpolate p1 p2 amt)
MediaScheme Point Procedure. Create a new point which is amt percent (expressed as a real number between 0 and 1) of the way from p1 to p2
(point-new col row)
MediaScheme Point Procedure. Build a new value that represents the point at (col,row).
(point-offset point hoff voff)
MediaScheme Point Procedure. Create a new point that is offset from point horizontally by hoff and vertically by voff.
(point-row p)
MediaScheme Point Procedure. Extract the row (y value) from point p.
(positive? num)
Standard Scheme Procedure. Determine whether the numeric value num is positive (greater than zero).
(pressure-valid? val)
MediaScheme GIMP Procedure. Determine whether the value is a valid pressure. Used primarily for precondition testing.

Q

(quotient dividend divisor)
Standard Scheme Procedure. Find the quotient of dividend and divisor, both of which must be integers. The quotient is the whole part of the result of dividing dividend by divisor.

R

(random-points n cols rows)
MediaScheme Point Procedure. Create n points, each of which is difficult to predict and each with a non-negative column less than cols and a non-negative row less than rows.
(rational? val)
Optional Scheme Procedure. Determine whether val can be interpreted as a rational number.
(read)
Standard I/O Procedure. Read the next value available from the keyboard.
(read input-port)
Standard File Procedure. Read the next value available on the specified port. If no characters remain, returns the end-of-file object.
(read-char)
Standard I/O Procedure. Read the next character available from the keyboard (or other standard input port).
(read-char input-port)
Standard File Procedure. Read the next character available on the specified port. If no characters remain, returns the end-of-file object.
(real? val)
Standard Scheme Procedure. Determine whether val is a real number.
(recolor-drawing color drawing)
MediaScheme Drawing Procedure. Creates a new drawing by recoloring drawing in color. Note that even if drawing contained colors, the new drawing contains only a single color.
(region-scan image left top width height proc!)
MediaScheme GIMP Procedure. Scans through a region of the image, applying proc! at each position in the region. proc! should have the form (lambda (col row color) ...). In contrast to many of the other region procedures, region-scan is guaranteed to scan row-by-row from top-to-bottom, scanning each row from left to right.
(remainder dividend divisor)
Standard Scheme Procedure. Compute the remainder after doing whole-number division of dividend by divisor.
(repeat i proc!)
Extended Scheme Procedure. Call proc! (a zero-parameter procedure, a.k.a., a “thunk”) i times.
(repeat i proc! val)
Extended Scheme Procedure. Evaluate (proc! val)i times.
(repeat i proc! v1 ... vn)
Extended Scheme Procedure. Evaluate (proc! v1 ... vn)i times.
(reverse lst)
Standard List Procedure. Build a new list whose elements are the same as those of lst, but in the opposite order.
(right-section binproc right)
Traditional Higher-Order Procedure. Given a two-parameter procedure and a value, creates a new anonymous one-parameter procedure by filling in the second (right) parameter of the procedure. The new procedure, when applied to a value, v, returns (binproc v right).
(round num)
Standard Scheme Procedure. Round num toward the nearest integer. If the decimal portion of num is greater than 1/2, rounds up. If the decimal portion is less than 1/2, rounds down. If the decimal portion equals 1/2, may round in either direction. (In most implementations, numbers with fractional portions equal to 1/2 round toward the even number.)
(r-s binproc right)
Traditional Higher-Order Procedure. A shorthand for right-section.

S

(scale-drawing factorg drawing)
MediaScheme Drawing Procedure. Creates a new drawing by scaling drawing by factor. Note that every part of the drawing is scaled, including both the horizontal and vertical distance of each component of the drawing from the origin.
(section procedure value-or-hole-1 ... value-or-hole-n)
Mediascheme Higher-order Procedure/Macro. Creates a new procedure by specifying some of the parameters to procedure, leaving the rest as parameters for the result procedure. Holes (parameters for the result proedure) are indicated with the <> symbol.
(string? val)
Standard String Predicate. Determine if val is a string.
(string->number str)
Standard String Procedure. Given a string that naturally represents a number (e.g., "23" or "3.14", or even "2.11e-5"), return the corresponding number.
(substring str start end)
Standard String Procedure. Create a new string by selecting the characters at positions start to end-1 of str. Note that substring, like string-ref uses 0-based indexing.
(string<? str1 str2)
Standard String Procedure. Determine whether str1 lexicographically precedes str2. Both str1 and str2 must be strings.
(string<=? str1 str2)
Standard String Procedure. Holds if str1 is either the same as str2 or if str1 lexicographically precedes str2. Both str1 and str2 must be strings.
(string=? str1 str2)
Standard String Procedure. Holds if str1 is the same as str2. Both str1 and str2 must be strings.
(string>=? str1 str2)
Standard String Procedure. Holds if str1 is either the same as str2 or if str1 lexicographically follows str2. Both str1 and str2 must be strings.
(string>? str1 str2)
Standard String Procedure. Determine whether str1 lexicographically follows str2. Both str1 and str2 must be strings.
(string ch_0 ch_1 ... ch_n)
Standard String Procedure. Create a new string of length n+1, by concatenating all of ch_0 through ch_n.
(string-append str_0 str_1 ... str_n)
Standard String Procedure. Create a new string of by joining together str through str_n in order. (Much like append, but for strings, rather than lists.)
(string-ci<? str1 str2)
Standard String Procedure. Determine whether str1 lexicographically precedes str2, ignoring case. Both str1 and str2 must be strings.
(string-ci<=? str1 str2)
Standard String Procedure. Holds if str1 is either the same as str2 or if str1 lexicographically precedes str2, ignoring case. Both str1 and str2 must be strings.
(string-ci=? str1 str2)
Standard String Procedure. Holds if str1 is the same as str2, ignoring case. Both str1 and str2 must be strings.
(string-ci>=? str1 str2)
Standard String Procedure. Holds if str1 is either the same as str2 or if str1 lexicographically follows str2, ignoring case. Both str1 and str2 must be strings.
(string-ci>? str1 str2)
Standard String Procedure. Determine whether str1 lexicographically follows str2, ignoring case. Both str1 and str2 must be strings.
(string-length str)
Standard String Procedure. Determine the number of characters in str.
(string-ref str pos)
Standard String Procedure. Extract the character at a specified position from a string. Like list-ref, string-ref presupposes zero-based indexing; the position is specified by the number of characters that precede it in the string. Hence, the initial character in the string is at position 0, the next at position 1, and so on.)
(string->list str)
Standard String Procedure. Convert str to a list of characters. The ith element of the list is the ith character in the string.

T

(test-case description check-1 ... check-n)
RackUnit procedure. Create a new test case by running a series of checks.
(test-suite description check-or-test-or-suite-1 ... check-or-test-or-suite-n)
RackUnit procedure. Create a new test suite that groups together a variety of checks, tests, and other suites. Unlike tests and checks, which are executed immediately, test suites are objects that can be run separately.
(truncate num)
Standard Scheme Procedure. Remove any fractional part from num. That is, round toward zero.
(turtle-brush turtle)
MediaScheme Turtle Procedure. Get the brush the turtle uses to draw.
(turtle-brush-size turtle)
MediaScheme Turtle Procedure. Get the size of the brush that the turtle uses to draw.
(turtle-clone turtle)
MediaScheme Turtle Constructor. Make a clone of turtle (same position, direction, color, brush, etc.).
(turtle-col turtle)
MediaScheme Turtle Procedure. Get the column of the point at which the turtle resides.
(turtle-color turtle)
MediaScheme Turtle Procedure. Get the color of the brush that the turtle uses to draw.
(turtle-down! turtle)
MediaScheme Turtle Procedure. Put turtle's brush down. When the turtle moves forward, it draws with the brush.
(turtle-face! turtle angle)
MediaScheme Turtle Procedure. Make turtle face the direction specified by angle (clockwise from right).
(turtle-forward! turtle distance)
MediaScheme Turtle Procedure. Moves turtle forward by the specified distance.
(turtle-new image)
MediaScheme Turtle Constructor. Build a new turtle that draws on image.
(turtle-row turtle)
MediaScheme Turtle Procedure. Get the row of the point at which the turtle resides.
(turtle-set-brush! turtle brush)
MediaScheme Turtle Procedure. Set the brush that turtle draws with.
(turtle-set-color! turtle color)
MediaScheme Turtle Procedure. Set the color in which turtle draws.
(turtle-teleport! turtle col row)
MediaScheme Turtle Procedure. Move turtle to (col,row). Do not draw along the way.
(turtle-turn! turtle angle)
MediaScheme Turtle Procedure. Rotate turtle clockwise by angle degrees.
(turtle-up! turtle)
MediaScheme Turtle Procedure. Lifts turtle's brush. When turtle moves forward, it will not draw.
(turtle-world turtle)
MediaScheme Turtle Procedure. Determine the world on which turtle resides.

U

(usleep usec)
Optional Scheme Procedure. Pause for usec microseconds.

V

(vector val_0 val_1 ... val_n)
Standard Vector Procedure. Create a new vector of size n+1 of the form #(val_0 val_1 ... val_n).
(vector? val)
Standard Vector Predicate. Determine if val is a vector.
(vector->list vec)
Standard Vector Procedure. Convert vec to a list so that the ith value in the list is the same as the ith value in the vector.
(vector-fill! vec val)
Standard Vector Procedure. Fill vec with multiple copies of val.
(vector-length vec)
Standard Vector Procedure. Determine the size of vec.
(vector-ref vec n)
Standard Vector Procedure. Get the nth element of vec. Note that elements are numbered starting at 0.
(vector-set! vec k val)
Standard Vector Procedure. Set the kth element of vec to val. (Note that vectors use 0-based indexing.)
(vscale-drawing factor drawing)
MediaScheme Drawing Procedure. Creates a new drawing by vertically scaling drawing by factor. Note that every part of the drawing is scaled vertically, including the vertical distance of each component of the drawing from the origin.
(vshift-drawing amt drawing)
MediaScheme Drawing Procedure. Creates a new drawing by shifting drawing vertically by factor. If factor is positive, the drawing is shifted downward. If factor is negative, the drawing is shifted upward by the absolute value of factor.

W

(when test exp1 exp2 ... expn)
Optional Scheme Keyword. Evaluate test. If it holds, evaluate each expression in turn. Otherwise, do nothing.
(write value)
Standard File Procedure. Print the verbose representation of the specified value to standard output.
(write value output-port)
Standard File Procedure. Print the verbose representation of the specified value to the specified port.
(write-char ch)
Standard I/O Procedure. Write the the given character to the screen.
(write-char ch output-port)
Standard File Procedure. Write the the given character to the specified port.

Z

(zero? num)
Standard Scheme Procedure. Determine whether the numeric value num is zero.