# Reference

This list of procedures is also available in PDF.

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Non-Alphabetic.

`(+ val1 ... valn)`
Standard Numeric Procedure. Sum all the values.
`(- val)`
Standard Numeric Procedure. Negate val.
`(- val1 val2 ... valn)`
Standard Numeric Procedure. Subtract each of val2 through valn from val1.
`(* val1 ... valn)`
Standard Numeric Procedure. Compute the product of all the values.
`(/ val1 val2 ... valn)`
Standard Numeric Procedure. Divide val1 by each of val2 through valn.
`(= num1 num2)`
Standard Numeric Predicate. Determine if num1 is equal to num2.
`(< num1 num2 ... numn)`
Standard Numeric Predicate. Determine if num1 is less than num2 and num2 is less than num3 and so on and so forth.
`(<= num1 num2 ... numn)`
Standard Numeric Predicate. Determine if num1 is less than or equal to num2 and num2 is less than or equal to num3 and so on and so forth.
`(> num1 num2 ... numn)`
Standard Numeric Predicate. Determine if num1 is greather than num2 and num2 is greater than num3 and so on and so forth.
`(>= num1 num2 ... numn)`
Standard Numeric Predicate. Determine if num1 is greater than or equal to num2 and num2 is greater than or equal to num3 and so on and so forth.
`#f`
Standard Boolean Value. False.
`#t`
Standard Boolean Value. True.
`(and exp1 exp2 ... expn)`
Standard Syntax. Evaluate each expression in turn. If any of those values is false, return false. Otherwise, return the value of the last expression.
`(append lst1 lst2)`
Standard List Procedure. Create a new list by combining the elements of lst1 and lst2. The elements in each list remain in order, and the elements of lst1 all precede the elements of lst2.
`(caar lst)`
Standard List Procedure. Compute the car of the car of lst. That is, gets the second value in the list.
`(cadr lst)`
Standard List Procedure. Compute the car of the cdr of lst.
`(car lst)`
Standard List Procedure. Get the first element of lst.
`(cdar lst)`
Standard List Procedure. Compute the cdr of the car of lst.
`(cddr lst)`
Standard List Procedure. Compute the cdr of the cdr of lst.
`(cdr lst)`
Standard List Procedure. Get a list consisting of all but the first element of lst.
`(ceiling num)`
Standard/Numeric Procedure. Find the smallest integer which is greater than or equal to num.
`(cname->rgb string)`
DrFu Procedure. Build an RGB color that corresponds to the given name.
`color.black`
DrFu Value. A predefined name for 0/0/0.
`color.blue`
DrFu Value. A predefined name for 0/0/255.
`color.green`
DrFu Value. A predefined name for 0/255/0.
`(cname.list)`
DrFu Procedure. List all the valid color names.
`(cname.list str)`
DrFu Procedure. List all the valid color names that contain str.
`color.red`
DrFu Value. A predefined name for 255/0/0.
`color.white`
DrFu Value. A predefined name for 255/255/255.
`(compose f g)`
Traditional Higher-Order Procedure. Compose two procedures. The result is a function that, when applied to a value, x, computes f of g of x.
`(cond (test1 consequent1) (test2 consequent2) ... (testn consequentn) (else alternative))`
Standard Keyword. Evaluate each test in turn until one is truish. It then evaluates the corresponding expression and returns its value. If none of the tests is truish, then evaluate the alternative and returns its value.
`(cons value lst)`
Standard List Procedure. Create a new list by prepending value to the front of lst.
`(cos angle)`
Compute the cosine of angle, which is in radians.
`(define name expression)`
Standard Syntax. Evaluate the given expression and then associate it with the given name. The name can then be used in subsequent commands.
`(exact? num)`
Standard Numeric Predicate. Determine if num is represented exactly.
`(expt num power)`
Standard Numeric Procedure. Compute numpower.
`(floor num)`
Standard Numeric Procedure. Find the smallest integer which is smaller than or equal to num.
`(foreach! func list)`
Traditional List Procedure. Evaluate func on each element of the given list. Called primarily for side effects.
`(if test consequent alternative)`
Standard Syntax. 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)`
DrFu Predicate. Determine if val is an image.
`(image.get-pixel image column row)`
DrFu Procedure. Get the pixel at the specified position in the image.
`(image.height image)`
DrFu Procedure. Determine the height of the given image.
`(image.load filename)`
DrFu Procedure. Load an image from a file. The name of the file is typically surrounded by quotation marks.
`(image.map fun image)`
DrFu 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.map! fun image)`
DrFu Procedure. Modify image by setting each pixel to the result of applying fun to the color pixel.
`(image.new width height)`
DrFu Procedure. Create a new image of specified width and height.
`(image.set-pixel! image column row rgb-color)`
DrFu Procedure. Set the pixel at the specified position to the new color.
`(image.show image)`
DrFu Procedure. Open a new window with the image.
`(image.transform-pixel! image col row func)`
DrFu Procedure. Modify the pixel at (col,row) in image by applying func to its old color and setting that pixel to the resulting color.
`(integer? val)`
Standard Numeric Predicate. Determine if val is an integer.
`(image.width image)`
DrFu Procedure. Determine the width of the given image.
`(inexact? num)`
Standard Numeric Predicate. Determine if num is approximated, rather than represented exactly.
`(lambda (params) body)`
Standard Syntax. A procedure which takes as input the names listed in params, does the computation indicated by body, and returns the value of the last expression in body.
`(left-section proc left)`
Traditional Procedure. Given a two-parameter procedure, proc, and a value, left, create a new one-parameter procedure that applies proc to left and the parameter. That is, the result is `(lambda (x) (proc left x))`.
`(length lst)`
Determine the number of elements in lst.
`(let ((name1 exp1) ... (namen exp1)) body)`
Standard Syntax. First, evaluate all of the expressions. Next update the bindings table to associate each name with the value of the corresponding expression. Third, evaluate the body with the updated binding table. Fourth, undo the bindings. Finally, return the value of the body.
`(let proc ((param1 init1) ... (paramn init1)) body)`
Standard Syntax. The definition and call of a recursive procedure. Create a new procedure with parameters param1 ... paramn and body body. Next, call that procedure with values init1 ... initn. Remove the procedure from the binding table and return the value of the call.
Standard Syntax. Evaluate each expression, in turn, updating the bindings table to associate the value with the corresponding name. (That is, the evluation of an expression is done with a binding table updated by the previous name/expression pairs.) After all the name/value pairs are bound, evaluate the expression. Finally, undo the bindings and return the value of the body.
`(letrec ((name1 exp1) ... (namen exp1)) body)`
Standard Syntax. A lot like `let`, except that it works for recursive procedures. (The particularly technique used is not important.)
`(list val1 ... valn)`
Standard List Procedure. Build a list of the specified values.
`(list-ref lst n)`
Standard List Procedure. Get the nth element of lst. Note that elements are numbered starting at 0.
`(log num)`
Standard Numeric Procedure. Compute the natural logarithm of nu.
`(l-s proc left)`
Traditional Procedure. Given a two-parameter procedure, proc, and a value, left, create a new one-parameter procedure that applies proc to left and the parameter. That is, the result is `(lambda (x) (proc left x))`.
`(map fun lst)`
Standard List Procedure. Create a new list, each of whose elements is computed by applying fun to the corresponding element of lst.
`(max num1 ... numn)`
Standard Numeric Procedure. >Find the largest value in num1 ... numn.
`(min num1 ... numn)`
Standard Numeric Procedure. >Find the smallest value in num1 ... numn.
`(modulo value modulus)`
Standard Numeric Procedure. Similar to `remainder`, except guarantees that the result has the same sign as the modulus. For positive modulus, returns a value in the range 0..modulus-1, inclusive.
`nil`
Standard List Value. The empty list.
`(not exp)`
Standard Boolean Procedure. If the value of the expression is false, returns true (`#t`). Otherwise, returns false (`#f`).
`(or exp1 exp2 ... expn)`
Standard Syntax. Evaluate each expression in turn. If all of those values is false, return false. Otherwise, return the value of the first non-false expression.
`pi`
Traditional Numeric Constant. Half of the ratio of the circumference to the radius of a circle.
`(position.col pos)`
DrFu Procedure. Extract the column from position pos.
`(position.new col row)`
DrFu Procedure. Build a new position that represents the point at (col,row).
`(position.row pos)`
DrFu Procedure. Extract the row from position pos.
`(quotient dividend divisor)`
Standard Numeric Procedure. Compute the integer result of dividing dividend by divisor.
`(real? value)`
Standard Numeric Predicate. Determine if value is a real number.
`(region.compute-pixels! image first-col first-row last-col last-row function)`
DrFu Procedure. Create a portion of an image by calling function on every position in the specified region.
`(remainder dividend divisor)`
Standard Numeric Procedure. Compute the remainder left after dividing dividend by divisor.
`(reverse lst)`
Standard List Procedure. Build a new list whose elements are the same as those of lst, but in the opposite order.
`(rgb? value)`
DrFu Predicate. Determine if value can be interpreted as a color.
`(rgb.blue color)`
DrFu Procedure. Get the blue component of an RGB color.
`(rgb.bluer rgb-color)`
DrFu Procedure. Build a bluer version of the given color.
`(rgb.complement rgb-color)`
DrFu Procedure. Compute the psuedo-complement of the given color.
`(rgb.darker rgb-color)`
DrFu Procedure. Build a darker version of the given color.
`(rgb.green color)`
DrFu Procedure. Get the green component of an RGB color.
`(rgb.greener rgb-color)`
DrFu Procedure. Build a greener version of the given color.
`(rgb.lighter rgb-color)`
DrFu Procedure. Build a lighter version of the given color.
`(rgb.map fun color)`
DrFu Procedure. Create a new color by applying fun to each component of color.
`(rgb.new r g b)`
DrFu Procedure. Build an RGB color whose red, green, and blue components are the specified values.
`(rgb.red color)`
DrFu Procedure. Get the red component of an RGB color.
`(rgb.redder rgb-color)`
DrFu Procedure. Build a redder version of the given color.
`(rgb.rotate rgb-color)`
DrFu Procedure. Rotate the three components of the given color, setting the red component to the value of green, green to the value of blue, and blue to the value of red.
`(rgb->rgb-list color)`
DrFu Procedure. Convert the given color to a list of its three components.
`(rgb->string color)`
DrFu Procedure. Convert the given color to an easy-to-read string.
`(right-section proc left)`
Traditional Procedure. Given a two-parameter procedure, proc, and a value, right, create a new one-parameter procedure that applies proc to that parameter and right. That is, the result is `(lambda (x) (proc x right))`.
`(round num)`
Standard Numeric Procedure. Round num to the nearest integer. If num is equidistant from two integers, then it typically rounds to the nearest even integer.
`(r-s proc left)`
Traditional Procedure. Given a two-parameter procedure, proc, and a value, right, create a new one-parameter procedure that applies proc to that parameter and right. That is, the result is `(lambda (x) (proc x right))`.
`(sin angle)`
Compute the sine of angle, which is in radians.
`(sqrt num)`
Standard Numeric Procedure. Compute the square root of num.
`(truncate num)`
Standard Numeric Procedure. Convert num to an integer by removing the factional part.

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Sun Nov 25 14:05:14 2007.
The source to the document was last modified on Mon Nov 5 14:00:09 2007.
This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2007F/Reference/index.html`.

You may wish to validate this document's HTML ; ; Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright © 2007 Janet Davis, Matthew Kluber, and Samuel A. Rebelsky. (Selected materials copyright by John David Stone and Henry Walker and used by permission.) This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit `http://creativecommons.org/licenses/by-nc/2.5/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.