Functional Problem Solving (CSC 151 2014S) : Reference
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Setup] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2010S)] [Rebelsky (2013F)] [Weinman (2012F)] [Weinman (2014S)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)]
(=
num1
num2
)
num1
is equal to
num2
(<
num1
num2
...numn
)
num1
is strictly less than
num2
, and
num2
is strictly less than
num3
and so forth.
(<=
num1
num2
...numn
)
num1
is less than or equal to
num2
, and
num2
is less than
or equal to num3
and so forth.
(>
num1
num2
...numn
)
num1
is strictly greater than
num2
, and
num2
is strictly
greater than num3
and so forth.
(>=
num1
num2
...numn
)
num1
is greater than or equal to
num2
, and
num2
is greater than
or equal to num3
and so forth.
(^and
f1
f2
...
fn
)
and
. Creates
a new procedure that, when applied to some values, returns
(and (f1 values
)
(f2 values
)
...
(fn values
)).
(^not
pred?
)
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
)
or
. Creates
a new procedure that, when applied to some values, returns
(or (f1 values
)
(f2 values
)
...
(fn values
)).
(abs
num
)
num
.
(and
exp1
exp2
...
expn
)
(caar
lst
)
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
)
lst
,
the car
of the cdr
of lst
(caddr
lst
)
lst
,
the car
of the cdr
of the cdr
of lst
.
(car
lst
)
lst
.
(cdr
lst
)
lst
but without
the first element. (cadr
lst
)
lst
,
the car
of the cdr
of lst
(ceiling
num
)
num
. That is, round up.
(char?
val
)
val
is a character.
(char->integer
ch
)
ch
's position in the collating
sequence.
(char<?
ch1
ch2
)
ch1
precedes
ch2
in the collating sequence.
Both ch1
and ch2
must be characters.
(char<=?
ch1
ch2
)
ch1
equals
ch2
or if
ch1
precedes
ch2
in the collating sequence.
Both ch1
and ch2
must be characters.
(char=?
ch1
ch2
)
ch1
and
ch2
are the same. Both
ch1
and ch2
must
be characters.
(char>=?
ch1
ch2
)
ch1
and ch2
are equal or if ch1
follows
ch2
in the collating sequence.
Both ch1
and ch2
must be characters.
(char>?
ch1
ch2
)
ch1
follows
ch2
in the collating sequence.
Both ch1
and ch2
must be characters.
(char-alphabetic?
ch
)
ch
(which must be a
character) is an alphabetic character (in English, #\a, #\b, ... #\z,
#\A, #\B, ...., #\Z).
(char-ci<?
ch1
ch2
)
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
)
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
)
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
)
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
)
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
)
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
)
ch
(which must be a
character) represents a lower-case character
(in English, #\a, #\b, ... #\z).
(char-upper-case?
ch
)
ch
(which must be a
character) represents an upper-case character
(in English, #\a, #\b, ... #\z).
(char-numeric?
ch
)
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
)
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
)
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
)
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
)
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
)
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
)
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
)
(close-input-port
input-port
)
(close-output-port
output-port
)
(color?
val
)
val
is one of the various
valid forms of colors (integer encoded RGB colors, color names,
HSV lists, etc.).
(color->color-name
string
)
(color->hsv
color
)
(color->irgb
string
)
(color->rgb-list
color
)
(color->string
color
)
(color-name?
val
)
val
is a string representing a
color in the database of colors.
(color-name->irgb
string
)
(color-representation
color
)
(complex?
val
)
val
can be interpreted
as a complex number.
(compose
f
g
)
((compose f g) x)
is the same as (f (g x))
.
(cons
value
lst
)
value
to the front of lst
.
(constant
value
)
value
,
no matter what parameters it is applied to.
(context-get-bgcolor
)
(context-get-brush
)
(context-get-color-names
)
(context-get-fgcolor
)
(context-list-brushes
)
(context-list-brushes
pattern
)
(context-list-colors
)
(context-list-colors
pattern
)
(context-list-fonts
)
(context-list-fonts
pattern
)
(context-set-bgcolor!
color
)
(context-set-brush!
brush-name
)
,
(context-set-brush!
brush-name
brush-size
)
(context-set-fgcolor!
color
)
(context-update-displays!
)
(delete-file
filename
)
(display
value
)
value
on the screen.
(display
value
output-port
)
value
on the specified
port.
(drawing?
value
)
value
can be interpreted
as a drawing.
drawing-blank
(drawing-blank?
value
)
value
can be interpreted
as a blank drawing.
(drawing-bottom
drawing
)
(drawing-color
drawing
)
(drawing-compose
list-of-drawings
)
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
)
drawing1
is at the bottom and
drawingn
is at the top.
(drawing-height
drawing
)
(drawing-hscale
drawing
factor
)
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
)
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
)
(drawing-outline
drawing
brush
)
drawing
with brush
.
Element colors are preserved. After outlining, no elements
of the resulting drawing are filled.
(drawing-recolor
drawing
color
)
drawing
in color
.
Note that even if drawing
contained
colors, the new drawing contains only a single color.
(drawing-render!
drawing
image
)
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
)
(drawing-scale
drawing
factor
)
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
)
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
)
(drawing-type
drawing
)
ellipse
for ellipses and circles,
rectangle
for rectangles and squares,
group
for grouped drawings, and
line
for lines (not yet supported).
drawing-unit-circle
drawing-unit-square
(drawing-vscale
drawing
factor
)
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
)
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
)
(eof-object?
val
)
val
is something returned by
read
(or read-char
or
peek-char
) to indicate the end of input.
(error
message
)
(error
message
val1
... valn
)
(even?
int
)
int
is
even (that is, has a remainder of 0 when divided by 2).
(exact?
num
)
num
is
represented exactly (that is, not approximated).
(exact->inexact
num
)
num
.
(expt
base
power
)
base
power
.
(file-exists?
filename
)
(filter
pred?
lst
)
lst
for which
pred?
holds.
(filter
means to “filter in”,
not to “filter out”.)
(floor
num
)
num
. That is, round down.
(for-each
proc!
lst
)
proc!
to each element of the
given list. Called primarily for side effects.
(hscale-drawing
factor
drawing
)
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
)
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
.
(if
test
consequent
alternative
)
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
)
val
is an image.
(image-airbrush-line!
image
pressure
col1
row1
col2
row2
)
(image-blot!
image
col
row
)
(image-compute
pos2color
width
height
)
pos2color
(a function of the form (lambda (col row) color)
)
to compute the color at each position in the image.
(image-draw-line!
image
col1
row1
col2
row2
)
(image-fill-selection!
image
)
(image-get-pixel
image
column
row
)
(image-height
image
)
(image-load
filename
)
(image-new
width
height
)
(image-refresh-display!
image
)
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
)
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
)
(image-select-ellipse!
image
selection-type
left
top
width
height
)
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
)
(image-select-nothing!
image
)
(image-select-polygon!
image
selection-type
positions
)
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
)
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
)
(image-show
image
)
(image-stroke-selection!
image
)
(image-transform!
image
fun
)
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
)
col
,row
)
in image
by applying
func
to its old color and setting that
pixel to the resulting color.
(image-variant
image
fun
)
image
, each of whose pixels is computed
by applying fun
to the color of the
corresponding pixel in image
.
(image-width
image
)
(inexact?
num
)
num
is
represented inexactly (that is, approximated).
(inexact->exact
num
)
num
.
(Of course, if num
was already
approximated, the result, while exact, still approximates
whatever num
approximated.)
(input-port?
val
)
val
is an open input port.
(integer?
val
)
val
is an integer.
(integer->char
n
)
n
th character in the
collating sequence.
(irgb
r
g
b
)
(irgb?
value
)
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
)
(irgb->hsv
irgb-color
)
(irgb->rgb-list
irgb-color
)
(irgb->string
irgb-color
)
(irgb-bluer
irgb-color
)
(irgb-blue
irgb-color
)
(irgb-complement
irgb-color
)
(irgb-darker
irgb-color
)
(irgb-greener
irgb-color
)
(irgb-green
color
)
(irgb-lighter
irgb-color
)
(rgb-list->irgb
rgb-lst
)
(r g b)
into an integer-encoded RGB color.
(irgb-new
r
g
b
)
(irgb-phaseshift
irgb-color
)
(irgb-redder
irgb-color
)
(irgb-red
irgb-color
)
(irgb-rotate
irgb-color
)
(lambda
(params)
expression1
...
expressionn
)
params
, does the computation indicated
by the expressions, and returns the value of the last expression.
(left-section
binproc
left
)
v
, returns
(binproc
left
v
)
.
(list
val_0
val_1
...
val_n
)
n
+1 of the form
(val_0
val_1
... val_n
)
.
(list->string
char-list
)
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
)
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
)
n
elements of lst
.
(list-ref
lst
n
)
n
th element of
lst
. Note that elements are numbered
starting at 0.
(list-take
lst
n
)
n
elements of lst
.
(l-s
binproc
left
)
left-section
.
(make-list
n
val
)
n
copies of val
.
(make-string
length
ch
)
length
,
containing only copies of ch
.
(make-vector
length
val
)
length
,
containing only copies of val
.
(map
func
lst
)
func
to the corresponding element of
lst
.
(max
v1
v2
)
v1
and
v2
.
(max
v1
v2
...
vn
)
v1
through vn
.
(member
val
lst
)
val
appears in
lst
. If so, returns the sublist
that starts with val
.
If not, returns false
(#f
).
(member?
val
lst
)
val
appears in
lst
. If so, returns true
(#t
). If not, returns false
(#f
).
(min
v1
v2
)
v1
and
v2
.
(min
v1
v2
...
vn
)
v1
through vn
.
(modulo
value
modulus
)
modulus
-sized sections, gives the
offset of value
from the start of its
section.
(negative?
num
)
num
is
negative (less than zero).
(newline
)
(newline
output-port
)
(null?
lst
)
lst
is the empty list.
null
(number?
val
)
val
is a number.
(number->string
num
)
num
to an appropriate textual
representation.
(o
f1
f2
...
fn-1
fn
)
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
)
int
is
odd (that is, has a remainder of 1 when divided by 2).
(open-input-file
filename
)
(open-output-file
filename
)
(or
exp1
exp2
...
expn
)
(output-port?
val
)
val
is an open output port.
(peek-char
)
(peek-char
input-port
)
(point
col
row
)
col
,row
).
(point?
value
)
value
is a point (or can
be interpreted as such).
(point-col
p
)
p
.
(point-distance
p1
p2
)
p1
and
p2
.
(point-interpolate
p1
p2
amt
)
amt
percent
(expressed as a real number between 0 and 1) of the way from
p1
to p2
(point-new
col
row
)
col
,row
).
(point-offset
point
hoff
voff
)
point
horizontally by hoff
and vertically
by voff
.
(point-row
p
)
p
.
(positive?
num
)
num
is
positive (greater than zero).
(pressure-valid?
val
)
(quotient
dividend
divisor
)
dividend
and
divisor
, both of which must be integers.
The quotient is the whole part of the result of dividing
dividend
by divisor
.
(random-points
n
cols
rows
)
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
)
val
can be interpreted
as a rational number.
(read
)
(read
input-port
)
(read-char
)
(read-char
input-port
)
(real?
val
)
val
is a real number.
(recolor-drawing
color
drawing
)
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!
)
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
)
dividend
by divisor
.
(repeat
i
proc!
)
proc!
(a zero-parameter procedure,
a.k.a., a “thunk”) i
times.
(repeat
i
proc!
val
)
(proc!
val
)
i
times.
(repeat
i
proc!
v1
...
vn
)
(proc!
v1
...
vn
)
i
times.
(reverse
lst
)
lst
, but in the opposite order.
(right-section
binproc
right
)
v
, returns
(binproc
v
right
)
.
(round
num
)
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
)
right-section
.
(scale-drawing
factorg
drawing
)
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.
(string?
val
)
val
is a string.
(string->number
str
)
"23"
or "3.14"
, or even
"2.11e-5"
), return the corresponding number.
(substring
str
start
end
)
start
to end
-1
of str
. Note that
substring
, like string-ref
uses 0-based indexing.
(string<?
str1
str2
)
str1
lexicographically
precedes str2
.
Both str1
and str2
must be strings.
(string<=?
str1
str2
)
str1
is either the same as
str2
or if str1
lexicographically precedes str2
.
Both str1
and str2
must be strings.
(string=?
str1
str2
)
str1
is the same as
str2
.
Both str1
and str2
must be strings.
(string>=?
str1
str2
)
str1
is either the same as
str2
or if str1
lexicographically follows str2
.
Both str1
and str2
must be strings.
(string>?
str1
str2
)
str1
lexicographically
follows str2
.
Both str1
and str2
must be strings.
(string
ch_0
ch_1
...
ch_n
)
n
+1,
by concatenating all of
ch_0
through ch_n
.
(string-append
str_0
str_1
...
str_n
)
str
through str_n
in order. (Much like append
, but for
strings, rather than lists.)
(string-ci<?
str1
str2
)
str1
lexicographically
precedes str2
, ignoring case.
Both str1
and str2
must be strings.
(string-ci<=?
str1
str2
)
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
)
str1
is the same as
str2
, ignoring case.
Both str1
and str2
must be strings.
(string-ci>=?
str1
str2
)
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
)
str1
lexicographically
follows str2
, ignoring case.
Both str1
and str2
must be strings.
(string-length
str
)
str
.
(string-ref
str
pos
)
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
)
str
to a list of characters.
The ith element of the list is the
ith character in the string.
(test-case
description
check-1
...
check-n
)
(test-suite
description
check-or-test-or-suite-1
...
check-or-test-or-suite-n
)
(truncate
num
)
num
.
That is, round toward zero.
(turtle-brush
turtle
)
(turtle-brush-size
turtle
)
(turtle-clone
turtle
)
turtle
(same position, direction, color, brush, etc.).
(turtle-col
turtle
)
(turtle-color
turtle
)
(turtle-down!
turtle
)
turtle
's brush down. When the turtle
moves forward, it draws with the brush.
(turtle-face!
turtle
angle
)
turtle
face the direction specified by
angle
(clockwise
from right).
(turtle-forward!
turtle
distance
)
turtle
forward by the specified distance.
(turtle-new
image
)
image
.
(turtle-row
turtle
)
(turtle-set-brush!
turtle
brush
)
turtle
draws with.
(turtle-set-color!
turtle
color
)
turtle
draws.
(turtle-teleport!
turtle
col
row
)
turtle
to
(col
,row
).
Do not draw along the way.
(turtle-turn!
turtle
angle
)
turtle
clockwise by
angle
degrees.
(turtle-up!
turtle
)
turtle
's brush. When
turtle
moves forward, it
will not draw.
(turtle-world
turtle
)
turtle
resides.
(usleep
usec
)
(vector
val_0
val_1
...
val_n
)
n
+1 of the form
#(val_0
val_1
... val_n
)
.
(vector?
val
)
val
is a vector.
(vector->list
vec
)
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
)
vec
with multiple copies of
val
.
(vector-length
vec
)
vec
.
(vector-ref
vec
n
)
n
th element of
vec
. Note that elements are numbered
starting at 0.
(vector-set!
vec
k
val
)
k
th element of
vec
to val
.
(Note that vectors use 0-based indexing.)
(vscale-drawing
factor
drawing
)
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
)
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
.
(when
test
exp1
exp2
...
expn
)
test
. If it holds, evaluate
each expression in turn. Otherwise, do nothing.
(write
value
)
(write
value
output-port
)
(write-char
ch
)
(write-char
ch
output-port
)
(zero?
num
)
num
is
zero.
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Partners] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Setup] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2010S)] [Rebelsky (2013F)] [Weinman (2012F)] [Weinman (2014S)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)]
Samuel A. Rebelsky, rebelsky@grinnell.edu
Copyright (c) 2007-2014 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)
This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-nc/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.