# All procedures

## A

(above i1 i2 ... in [description])— Create a new image with images i1 through in placed in a stack, each above the next.

(all-of pred_1? ... pred_n?)— Returns a predicate of one parameter, val, that checks whether all of pred_1?pred_n? hold on val.

(and exp1 exp2 ... expn)— Evaluate each expression in turn until one of them returns false or we run out expressions. In the former case, returns false (#f). In the latter case, returns the value of expn.

(any-of pred_1? ... pred_n?)— Returns a predicate of one parameter, val, that checks whether any of pred_1?pred_n? hold on val.

## B

(beside/align valignment i1 i2 ... in [description])— Place i1 through in in a row beside one another, aligned as described.

(beside i1 i2 ... in [description])— ;; description : string? Create an image with i1 through in placed beside each other in a row.

## C

(car pair)— Grabs the first element of the pair.

(car lst)— Grabs the first element of lst.

(cdr pair)— Grabs the second element of the pair.

(cdr lst)— Grabs all but the first element of lst.

(circle? img)— Determine if the image is a circle.

(compound-image? val)— Determines if val is a compound image, one build by combining other images (e.g., with overlay, beside, or above).

(cond [guard0 exp0a exp0b ...] [guard1 exp1a exp1b ...] ... [else alt0 alt1 ... altn])— Evaluate each guard in turn until one holds (is not false). Then evaluate each of the corresponding expressions. Return the value of the last corresponding expression. If none of the guards holds, evaluate each of alt0 through altn, returning the value of altn.

(cons val1 val2)— Create a pair from val1 and val2.

(cons val lst)— Create a new list by adding val to the front of lst.

(crop img left top width height [description])— Crop img with the left edge at left, the top edge at top, and the specified width and height.

(curve source source-angle source-pull target target-angle target-pull color line-width [description])— Create a curve from source to target. The curve leaves source at the specified angle and enters target from the specified angle.

## D

(describe-image img)— Get the description of the image.

## E

(ellipse-height ell)— Determine the height of an ellipse. For outlined ellipses, this is the height of the inner ellipse.

(ellipse? img)— Determine if an image is an ellipse.

(ellipse-width ell)— Determine the width of an ellipse. For outlined ellipses, this is the width of the inner ellipse.

## H

(hflip img [description])— Flip img horizontally.

## I

(if guard consequent alternate)— Evaluate guard. If it holds (is not #f), evaluate consequent and return its value. If guard evaluates to #f, evavluate the alternate and return its value.

(image-color img)— Get the color of this image. Returns false if its a type of image that does not have a natural color.

(image-height img)— Get the height of the image.

(image-map fun img)— Apply a function to each basic image in an image.

(image-subtract img1 img2 [description])— “Subtract” img2 from img1, decreasing the opacity of each pixel in img1 by the opacity of the corresponding pixel in img2. image-subtract does not otherwise affect the colors in img1.

(image-width img)— Get the width of the image.

## L

(list-of pred?)— Builds a unary predicate that verifies that its parameter is a list, all of whose elements match pred?.

(list-ref lst pos)— Grabs the element at index pos from lst. Elements in lists are indexed starting at 0, so (list-ref lst 0) grabs the first element of the list.

(list val_1 ... val_n)— Create a list from the specified values.

## M

(make-polar radius angle)— Create the complex number that corresponds to the end of a vector of the given radius and angle from the origin.

## N

(negate? proc)— Returns a procedure that returns the negation of proc. That is, returns a procedure that returns not of the result of proc.

(nonnegative? val)— Determines if val is non-negative (greater than or equal to 0).

(not val)— If val is false (#f), return true (#t). If val is anything else, return false.

## O

(or exp1 exp2 ... expn)— Evaluate each expression in turn until one of them returns a truish value (one that is not false). Return that value. If all of the expressions return false, returns false.

(outlined-circle diameter color [description])— Create an outlined circle with the given diameter and color.

(outlined-equilateral-triangle width height color line-width [desc])— An outlined equilateral-triangle whose inner size is width-by-height with an outline of line-width. The inner triangle is transparent.

(outlined-polygon points color pen-width [description])— Create a polygon whose vertices are given by points and which is outlined by a color line whose width is given by line-width.

(outlined-rectangle width height color line-width [description])— A rectangle of the specified width and height, outlined with a line of the specified color and width.

(outlined-square side color line-width [description])— Create an outlined square with the given side length and color.

(overlay/align halignment valignment i1 i2 ... in [description])— Overlay the two images, aligning them as described.

(overlay img1 ... imgn [description])— Overlay img1 through imgn on top of each other, keeping them centered on each other.

## P

(place img xside x yside y bg)— Place img on bg, with the xside of img at x and the yside of img at y. Crop the result at the edges of bg.

(polygon? img)— Determines whether img is a polygon.

(pt x y)— Make a point.

## R

(random)— Compute an unpredictable number between 0 (inclusive) and 1 (exclusive).

(random n)— Compute an unpredictable number between 0 (inclusive) and n (exclusive).

(random lb ub)— Compute an unpredictable number between lb (inclusive) and ub (exclusive).

(rgb-greyscale c)— Convert c to greyscale (or approximately greyscale).

(rgb-red rgb-color)— Extract the red component of an RGB(A) color.

(rotate img angle [description])— Create a new image by rotating img by angle degrees counter-clockwise.

## S

(solid-circle diameter color [description])— Create a solid circle with the given diameter and color.

(solid-ellipse width height color [description])— Create a width-by-height ellipse whose color is color.

(solid-equilateral-triangle? val)— Determines if val is a solid equilateral triangle.

(solid-equilateral-triangle edge color [description])— A solid equilateral triangle of the given edge length and color.

(solid-polygon points color [description])— Create a polygon whose vertices are given by points and whose color is color.

(solid-rectangle width height color [description])— A polygon whose vertices are given by points and whose color is color.

(solid-square side color [description])— Create a solid square with the given side length and color.

(square? img)— Determines if img is a square (solid or outlined).

(subimages img)— Get a list of all the subimages of the current image.

## V

(vector-of pred?)— Builds a unary predicate that verifies that its parameter is a vector, all of whose elements match pred?.

(vflip img [description])— Flip img vertically.