Version: 5.2.0.901
WeScheme
WeScheme is an web-based
programming environment that allows us to write, run, and share
programs on the web. Programs written in WeScheme should be available
from any computer with a capable Javascript-enabled web browser. The
editing environment, the compiler, and the associated runtime
libraries are all hosted on WeScheme, eliminating installation
hassles. WeScheme allows us to easily share programs by creating
share URLs; these share URLs can be used to run a program or, if the
author permits it, allow anyone to view the source to that program.
Web programs are typically interactive, so WeScheme provides special
support for World programs that can interact with timer ticks,
keyboard events, and images.
1 Example programs
Here are a few example programs that can give an idea of the kinds
of things you can do in WeScheme. You can:
2 The environment
Let’s jump in and explore WeScheme by running a few programs.
Open up a web browser to http://www.wescheme.org. Press the
Start Coding button. The following editor page should be
divided into a top definitions section, and a bottom
interactions section. Click onto the definitions top
half of the window and enter in the following text, quotes and all:
"hello world"
Next, press the Run button at the toolbar at the top. If all
goes well, we should see a "hello world" appear on the bottom
window.
Next, change the line so it says:
(bitmap/url "http://racket-lang.org/logo.png")
Press the Run button again. We should now see an image in the
Interactions window.
Web images are values, as are strings, numbers, booleans, and
structures. You can even apply algebra on them. Try:
or
3 World programming and Images API
| (big-bang w h ...) → world |
| w : world |
| h : big-bang-handler |
Start a big bang computation. The
big-bang consumes an initial world,
as well as several handlers to configure it, described in this section:
| (on-tick tick-f delay) → big-bang-handler |
| tick-f : ([w world] -> world) |
| delay : real |
| (on-tick tick-f) → big-bang-handler |
| tick-f : ([w world] -> world) |
Tells
big-bang to update the world during clock ticks.
By default, this will send a clock tick 28 times a second, but if
given delay, it will use that instead.
| ;; The world is a number |
| ;; tick: world -> world |
| (define (tick world) |
| (add1 world)) |
| |
| (big-bang 0 |
| (on-tick tick 2)) ;; tick every two seconds |
| (on-key key-f) → big-bang-handler |
| key-f : ([w world] [k key] -> world) |
Tells
big-bang to update the world when a key is pressed. The
key-f
function will be called with the particular key being pressed.
| ;; The world is a number. |
| |
| ;; handle-key: world key -> image |
| (define (handle-key w k) |
| (cond [(key=? k "up") |
| (add1 w)] |
| [(key=? k "down") |
| (sub1 w)] |
| [else |
| w])) |
| (big-bang 0 |
| (on-key handle-key)) |
| (key=? a-key a-string) → boolean |
| a-key : key |
| a-string : string |
Returns true if a-key is equal to a-string.
| (to-draw draw-f) → big-bang-handler |
| draw-f : ([w world] -> image) |
Tells
big-bang how to update what the world looks like. The draw
function will be called every time an event occurs.
| ;; The world is a number. |
| |
| ;; draw: world -> image |
| (define (draw world) |
| (circle world "solid" "blue")) |
| |
| (big-bang 20 |
| (to-draw draw)) |
To support some legacy WeScheme applications, the name
on-redraw is an alias for to-draw.
| (stop-when stop?) → big-bang-handler |
| stop? : ([w world] -> boolean) |
Here is a listing of the functions you can use to make images.
|
| red : (and/c natural-number/c (<=/c 255)) |
| green : (and/c natural-number/c (<=/c 255)) |
| blue : (and/c natural-number/c (<=/c 255)) |
| alpha : (and/c natural-number/c (<=/c 255)) |
The
color struct defines a color with
red,
green,
blue, and
alpha components
that range from
0 to
255.
The red, green, and blue fields
combine to make a color, with the higher values meaning more of the given color.
For example, (make-color 255 0 0) makes a
bright red color and (make-color 255 0 255) makes a bright purple.
The alpha field controls the transparency of the color. A value of 255 means
that the color is opaque and 0 means the color is fully transparent.
The constructor, make-color, also accepts only three arguments, in which case
the three arguments are used for the red, green, and blue fields, and the
alpha field defaults to 255.
Creates an empty scene, i.e., a white rectangle with a black outline.
The three-argument version creates a rectangle of the specified color with
a black outline.
Adds a line to the image
scene, starting from the point (
x1,
y1)
and going to the point (
x2,
y2); unlike
add-line, this function crops the resulting image to the size of
scene.
Places image onto scene with its center at the coordinates
(x,y) and crops the resulting image so that it has the
same size as scene. The coordinates are relative to the top-left
of scene.
Creates a pinhole in image at the point (x,y).
Constructs a circle with the given radius, height, mode, and color.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Constructs a star with five points. The side-length argument
determines the side length of the enclosing pentagon.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Example: |
| > (star 40 "solid" "gray") | 
|
|
Constructs a star-like polygon where the star is specified by two radii and a number of points.
The first radius determines where the points begin, the second determines where they end, and
the point-count argument determines how many points the star has.
Constructs an arbitrary regular star polygon (a generalization of the regular polygons).
The polygon is enclosed by a regular polygon with side-count sides each
side-length long. The polygon is actually constructed by going from vertex to
vertex around the regular polgon, but skipping over every step-count vertices.
For examples, if side-count is 5 and step-count is 2,
then this function produces a shape just like star.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Overlays all of its arguments building a single image. The first argument goes
on top of the second argument, which goes on top of the third argument, etc.
The images are all lined up on their centers.
Constructs a polygon connecting the given vertices.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Constructs a rectangle with the given width, height, mode, and color.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Constructs a regular polygon with side-count sides.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Constructs a four sided polygon with all equal sides and thus where opposite angles are equal to each
other. The top and bottom pair of angles is
angle and the left and right are
(- 180 angle).
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Examples: |
| > (rhombus 40 45 "solid" "magenta") | 
| | > (rhombus 80 150 "solid" "mediumpurple") | 
|
|
Constructs a square.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Examples: |
| > (square 40 "solid" "slateblue") | 
| | > (square 50 "outline" "darkmagenta") | 
|
|
Constructs a upward-pointing equilateral triangle.
The side-length argument
determines the
length of the side of the triangle.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Constructs a triangle with a right angle where the two sides adjacent
to the right angle have lengths side-length1 and side-length2.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Creates a triangle with two equal-length sides, of length side-length
where the angle between those sides is angle. The third
leg is straight, horizontally. If the angle is less than
180, then the triangle will point up and if the angle
is more, then the triangle will point down.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
To create a triangle given known sides and angles, the following
family of functions are useful:
They all construct a triangle oriented as follows:

Constructs an ellipse with the given width, height, mode, and color.
If the mode is 'outline or "outline", then the last
argument can be a pen struct or an image-color?, but if the mode
is 'solid or "solid", then the last argument must be an
image-color?.
Constructs an image representing a line segment that connects the points
(0,0) to (x1,y1).
Examples: |
| > (line 30 30 "black") | 
| | > (line -30 20 "red") | 
| | > (line 30 -20 "red") | 
|
|
Adds a line to the image
image, starting from the point (
x1,
y1)
and going to the point (
x2,
y2).
Unlike
scene+line, if the line passes outside of
image, the image
gets larger to accommodate the line.
Overlays all of its arguments building a single image. The first argument goes
on top of the second argument, which goes on top of the third argument, etc.
The images are all lined up on their centers.
Constructs an image by overlaying i1 on top of i2.
The images are initially lined up on their upper-left corners and
then i2 is shifted to the right
by x pixels to and down by y pixels.
This is the same as (underlay/xy i2 (- x) (- y) i1).
See also overlay/offset and underlay/offset.
Overlays all of its image arguments, much like the
overlay function, but using
x-place and
y-place to determine where the images are lined up. For example, if
x-place and
y-place are both
"middle", then the images are lined up
on their centers.
Underlays all of its arguments building a single image.
It behaves like overlay, but with the arguments in the reverse order.
That is, the first argument goes
underneath of the second argument, which goes underneath the third argument, etc.
The images are all lined up on their centers.
Constructs an image by underlaying i1 underneath i2.
The images are initially lined up on their upper-left corners and
then i2 is shifted to the right
by x pixels to and down by y pixels.
This is the same as (overlay/xy i2 (- x) (- y) i1).
See also underlay/offset and overlay/offset.
Underlays all of its image arguments, much like the
underlay function, but using
x-place and
y-place to determine where the images are lined up. For example, if
x-place and
y-place are both
"middle", then the images are lined up
on their centers.
Constructs an image by placing all of the argument images in a
horizontal row, aligned along their centers.
Constructs an image by placing all of the argument images in a horizontal row, lined
up as indicated by the y-place argument. For example, if y-place
is "middle", then the images are placed side by side with their centers
lined up with each other.
Constructs an image by placing all of the argument images in a
vertical row, aligned along their centers.
Constructs an image by placing all of the argument images in a vertical row, lined
up as indicated by the x-place argument. For example, if x-place
is "middle", then the images are placed above each other with their centers
lined up.
Rotates image by angle degrees in a counter-clockwise direction.
Scales image by factor.
The pen sizes are also scaled and thus draw thicker (or thinner)
lines than the original image, unless the pen was size
0. That pen size is treated specially to mean “the
smallest available line” and thus it always draws a one pixel
wide line; this is also the case for 'outline and "outline"
shapes that are drawn with an image-color? instead of
a pen.
Scales image by x-factor horizontally and by
y-factor vertically.
Crops image to the rectangle with the upper left at the point (x,y)
and with width and height.
Examples: |
| > (crop 0 0 40 40 (circle 40 "solid" "chocolate")) | 
| | > (crop 40 60 40 60 (ellipse 80 120 "solid" "dodgerblue")) | 
| | 
|
|
Returns an image just like image, except
with a black, single pixel frame drawn around the
bounding box of the image.
Generally speaking, this function is useful to
debug image constructions, i.e., to see where
certain sub-images appear within some larger image.
Flips image left to right.
Flipping images with text is not supported (so passing flip-horizontal an image
that contains a text or text/font image inside somewhere signals an error).
Flips image top to bottom.
Flipping images with text is not supported (so passing flip-vertical an image
that contains a text or text/font image inside somewhere signals an error).
Constructs an image that draws the given string, using the font size and color.
Examples: |
| > (text "Hello" 24 "olive") | 
| | > (text "Goodbye" 36 "indigo") | 
|
|
Constructs an image that draws the given string, using a complete font specification.
The face and the family combine to give the complete typeface. If
face is available on the system, it is used, but if not then a default typeface
based on the family is chosen. The style controls if the face is italic
or not (on Windows and Mac OS X, 'slant and 'italic are the same),
the weight controls if it is boldface (or light), and underline?
determines if the face is underlined. For more details on these arguments, see font%,
which ultimately is what this code uses to draw the font.
Examples: |
| > (text/font "Hello" 24 "olive" | | "Gill Sans" 'swiss 'normal 'bold #f) |
| 
| | > (text/font "Goodbye" 18 "indigo" | | #f 'modern 'italic 'normal #f) |
| 
| | > (text/font "not really a link" 18 "blue" | | #f 'roman 'normal 'normal #t) |
| 
|
|
Goes out on the web and downloads the image at url.
Downloading the image happens each time this function is called, so
you may find it simpler to download the image once with a browser
and then paste it into your program or download it and use bitmap.
Additionally, images inserted into a DrRacket window are treated as
bitmap images, as are instances of image-snip% and bitmap%.
Are x and
y the same image?
Returns a list of colors that correspond to the colors in the
image, reading from left to right, top to bottom.
Examples: |
| > (image->color-list (rectangle 2 2 "solid" "black")) | (list (color 0 0 0 255) (color 0 0 0 255) (color 0 0 0 255) (color 0 0 0 255)) | | (list (color 1 1 1 255) (color 2 2 2 255) (color 3 3 3 255) (color 4 4 4 255)) |
|
Converts a list of colors l to an image with the given
width and height and pinhole (x,y)
coordinates, specified with respect to the top-left of the image.
The remaining functions provide alpha-channel information as well. Alpha
channels are a measure of transparency; 0 indicates fully opaque and 255
indicates fully transparent.
Returns the distance from the top of the image to its baseline.
Unless the image was constructed with
text,
text/font
or, in some cases,
crop, this will be the same as its height.
A cropped image’s baseline is the same as the image’s baseline, if the
cropping stays within the original image’s bounding box. But if the cropping actually
enlarges the image, then the baseline can end up being smaller.
Determines if x is a mode suitable for
constructing images.
It can be one of
'solid, "solid", 'outline,
or "outline", indicating if the shape is
filled in or not.
It can also be an integer between 0 and 255 (inclusive)
indicating the transparency of the image. The integer 255 is
fully opaque, and is the same as "solid" (or 'solid).
The integer 0 means fully transparent.
Determines if
x represents a color. Strings, symbols,
and
color structs are allowed as colors.
For example,
"magenta", "black", 'orange, and 'purple
are allowed. Colors are not case-sensitive, so
"Magenta", "Black", 'Orange, and 'Purple
are also allowed, and are the same colors as in the previous sentence.
If a string or symbol color name is not recognized, black is used in its place.
The complete list of colors is available in the documentation for
color-database<%>.
Determines if x is a placement option
for the horizontal direction. It can be one
of "left",
'left,
"right",
'right,
"middle",
'middle,
"center",
'center,
"pinhole", or
'pinhole.
Using "pinhole" or 'pinhole is only allowed when all of the image arguments have pinholes.
Determines if x is a placement option
for the vertical direction. It can be one
of
"top",
'top,
"bottom",
'bottom,
"middle",
'middle,
"center",
'center,
"baseline",
'baseline,
"pinhole", or
'pinhole.
The baseline of an image is the place where the bottoms any letters line up, not counting descenders, e.g. the tail on “y” or “g” or “j”.
Using "pinhole" or 'pinhole is only allowed when all of the image arguments have pinholes.
Determines if x is an angle, namely
a real number between 0 (inclusive)
and 360 (exclusive).
Determines if x is an integer
greater than or equal to 3.
Determines if x is an integer greater than or equal to 1.
4 Basic operations
Checks that the first expression evaluates to the same value as the
expected-expression.
As a convenience, the name
EXAMPLE is an alias for
check-expect.
| * : (number ... -> number) |
Multiplys all given numbers.
| + : (number ... -> number) |
Adds all given numbers.
| - : (number ... -> number) |
Subtracts from the first all remaining numbers.
| / : (number ... -> number) |
Divides the first by all remaining numbers.
| < : (real real real ... -> boolean) |
Compares real numbers for less-than.
| <= : (real real real ... -> boolean) |
Compares real numbers for less-than or equality.
| = : (number number number ... -> boolean) |
Compares numbers for equality.
| =~ : (number number non-negative-real -> boolean) |
Checks whether two numbers are within some amount (the third argument) of either other.
| > : (real real real ... -> boolean) |
Compares real numbers for greater-than.
| >= : (real real real ... -> boolean) |
Compares real numbers for greater-than or equality.
Evaluates the absolute value of a real number.
| acos : (number -> number) |
Evaluates the arccosine (inverse of cos) of a number.
| add1 : (number -> number) |
Evaluates a number one larger than a given number.
| andmap : ((X -> boolean) (listof X) -> boolean) |
(andmap p (list x-1 ... x-n)) = (and (p x-1) ... (p x-n))
Extracts the angle from a complex number.
| append : ((listof any) ... -> (listof any)) |
Creates a single list from several.
| asin : (number -> number) |
Evaluates the arcsine (inverse of sin) of a number.
| atan : (number (number) -> number) |
Evaluates the arctan of the given number or the ratio of the two given numbers.
Determines whether two booleans are equal.
Determines whether some value is a boolean.
(build-list n f) = (list (f 0) ... (f (- n 1)))
| caaar | : | | ((cons | | (cons (cons W (listof Z)) (listof Y)) | | (listof X)) | | -> | | W) |
|
|
Selects the first item of the first list in the first list of a list.
| caadr | : | | ((cons | | (cons (cons W (listof Z)) (listof Y)) | | (listof X)) | | -> | | (listof Z)) |
|
|
Selects the rest of the first list in the first list of a list.
| caar : ((cons (cons Z (listof Y)) (listof X)) -> Z) |
Selects the first item of the first list in a list.
| cadar | : | | ((cons (cons W (cons Z (listof Y))) (listof X)) | | -> | | Z) |
|
|
Selects the second item of the first list of a list.
Selects the fourth item of a non-empty list.
| caddr : ((cons W (cons Z (cons Y (listof X)))) -> Y) |
Selects the third item of a non-empty list.
| cadr : ((cons Z (cons Y (listof X))) -> Y) |
Selects the second item of a non-empty list.
| car : ((cons Y (listof X)) -> Y) |
Selects the first item of a non-empty list.
| cdaar | : | | ((cons | | (cons (cons W (listof Z)) (listof Y)) | | (listof X)) | | -> | | (listof Z)) |
|
|
Selects the rest of the first list in the first list of a list.
| cdadr | : | | ((cons W (cons (cons Z (listof Y)) (listof X))) | | -> | | (listof Y)) |
|
|
Selects the rest of the first list in the rest of a list.
| cdar | : | | ((cons (cons Z (listof Y)) (listof X)) | | -> | | (listof Y)) |
|
|
Selects the rest of a non-empty list in a list.
| cddar | : | | ((cons (cons W (cons Z (listof Y))) (listof X)) | | -> | | (listof Y)) |
|
|
Selects the rest of the rest of the first list of a list.
| cdddr | : | | ((cons W (cons Z (cons Y (listof X)))) | | -> | | (listof X)) |
|
|
Selects the rest of the rest of the rest of a list.
| cddr : ((cons Z (cons Y (listof X))) -> (listof X)) |
Selects the rest of the rest of a list.
| cdr : ((cons Y (listof X)) -> (listof X)) |
Selects the rest of a non-empty list.
Determines the closest integer (exact or inexact) above a real number.
Lookups the number that corresponds to the given character in the ASCII table (if any).
Determines whether a character represents an alphabetic character.
Determines whether a character precedes another (or is equal to it) in a case-insensitive manner.
Determines whether a character precedes another in a case-insensitive manner.
Determines whether two characters are equal in a case-insensitive manner.
Determines whether a character succeeds another (or is equal to it) in a case-insensitive manner.
Determines whether a character succeeds another in a case-insensitive manner.
Determines the equivalent lower-case character.
Determines whether a character is a lower-case character.
Determines whether a character represents a digit.
Determines the equivalent upper-case character.
Determines whether a character is an upper-case character.
Determines whether a character represents space.
| char<=? : (char char char ... -> boolean) |
Determines whether a character precedes another (or is equal to it).
| char<? : (char char char ... -> boolean) |
Determines whether a character precedes another.
| char=? : (char char char ... -> boolean) |
Determines whether two characters are equal.
| char>=? : (char char char ... -> boolean) |
Determines whether a character succeeds another (or is equal to it).
| char>? : (char char char ... -> boolean) |
Determines whether a character succeeds another.
Determines whether a value is a character.
Determines whether some value is complex.
Evaluates the conjugate of a complex number.
| cons : (X (listof X) -> (listof X)) |
Constructs a list.
Determines whether some value is a constructed list.
Evaluates the cosine of a number (radians).
| cosh : (number -> number) |
Evaluates the hyperbolic cosine of a number.
Evaluates the current time in seconds elapsed (since a platform-specific starting date).
Evaluates the denominator of a rational.
Selects the eighth item of a non-empty list.
Determines whether some value is the empty list.
Determines whether some value is the end-of-file value.
| eq? : (any any -> boolean) |
Determines whether two values are equivalent from the computer’s perspective (intensional).
Determines whether two values are structurally equal where basic values are compared with the eqv? predicate.
| equal~? : (any any non-negative-real -> boolean) |
Compares like equal? on the first two arguments, except using =~ in the case of numbers.
| eqv? : (any any -> boolean) |
Determines whether two values are equivalent from the perspective of all functions that can be applied to it (extensional).
| error : (any ... -> void) |
signals an error, combining the given values into an error message.
If any of the values’ printed representations is too long, it is truncated and “...” is put into the string. If the first value is a symbol, it is treated specially; it is suffixed with a colon and a space (the intention is that the symbol is the name of the function signalling the error).
| even? : (integer -> boolean) |
Determines if some integer (exact or inexact) is even or not.
Converts an exact number to an inexact one.
Evaluates e raised to a number.
| expt : (number number -> number) |
Evaluates the power of the first to the second number.
Determines whether a value is false.
| fifth : ((listof Y) -> Y) |
Selects the fifth item of a non-empty list.
| first : ((cons Y (listof X)) -> Y) |
Selects the first item of a non-empty list.
| floor : (real -> integer) |
Determines the closest integer (exact or inexact) below a real number.
| foldl : ((X Y -> Y) Y (listof X) -> Y) |
(foldl f base (list x-1 ... x-n)) = (f x-n ... (f x-1 base))
| format : (string any ... -> string) |
Formats a string, possibly embedding values.
Selects the fourth item of a non-empty list.
| gcd : (integer integer ... -> integer) |
Evaluates the greatest common divisior of two integers (exact or inexact).
Returns the argument unchanged.
Extracts the imaginary part from a complex number.
Approximates an inexact number by an exact one.
Determines whether some number is inexact.
Lookups the character that corresponds to the given integer (exact only!) in the ASCII table (if any).
Determines whether some value is an integer (exact or inexact).
| lcm : (integer integer ... -> integer) |
Evaluates the least common multiple of two integers (exact or inexact).
| length : ((listof any) -> number) |
Evaluates the number of items on a list.
| list : (any ... -> (listof any)) |
Constructs a list of its arguments.
Returns #t if v is
a pair, #f otherwise.
| list* : (any ... (listof any) -> (listof any)) |
Constructs a list by adding multiple items to a list.
Converts a s list of characters into a string.
| list-ref : ((listof X) natural-number -> X) |
Extracts the indexed item from the list.
Evaluates the base-e logarithm of a number.
Determines the magnitude of a complex number.
Produces a string of given length from a single given character.
| map : ((X ... -> Z) (listof X) ... -> (listof Z)) |
Constructs a new list by applying a function to each item on one or more existing lists.
| max : (real real ... -> real) |
Determines the largest number.
| member : (any (listof any) -> boolean) |
Determines whether some value is on the list (comparing values with equal?).
| memq : (any (listof any) -> (union false list)) |
Determines whether some value is on some list if so, it produces the suffix of the list that starts with x if not, it produces false. (It compares values with the eq? predicate.)
| memv : (any (listof any) -> (union false list)) |
Determines whether some value is on the list if so, it produces the suffix of the list that starts with x if not, it produces false. (It compares values with the eqv? predicate.)
| min : (real real ... -> real) |
Determines the smallest number.
| modulo : (integer integer -> integer) |
Finds the remainder of the division of the first number by the second; try (modulo 4 3) (modulo 4 -3).
Determines if some value is strictly smaller than zero.
| not : (boolean -> boolean) |
Evaluates the negation of a boolean value.
Determines whether some value is the empty list.
Converts a number to a string.
Determines whether some value is a number.
Evaluates the numerator of a rational.
| odd? : (integer -> boolean) |
Determines if some integer (exact or inexact) is odd or not.
The ratio of a circle’s circumference to its diameter.
Determines if some value is strictly larger than zero.
Extracts the x component of a posn.
Extracts the y component of a posn.
| posn? : (anything -> boolean) |
Determines if its input is a posn.
Divides the first integer (exact or inexact) into the second; try (quotient 3 4) and (quotient 4 3).
| random | : | | (case-> | | (integer -> integer) | | (-> (and/c real inexact? (>/c 0) (</c 1)))) |
|
|
Generates a random natural number less than some given integer, or to generate a random inexact number between 0.0 and 1.0 exclusive.
Determines whether some value is a rational number.
Extracts the real part from a complex number.
Determines whether some value is a real number.
Determines the remainder of dividing the first by the second integer (exact or inexact).
| rest : ((cons Y (listof X)) -> (listof X)) |
Selects the rest of a non-empty list.
Creates a reversed version of a list.
| round : (real -> integer) |
Rounds a real number to an integer (rounds to even to break ties).
| second : ((cons Z (cons Y (listof X))) -> Y) |
Selects the second item of a non-empty list.
Selects the seventh item of a non-empty list.
| sgn : (real -> (union 1 1.0 0 0.0 -1 -1.0)) |
Evaluates the sign of a real number.
Evaluates the sine of a number (radians).
| sinh : (number -> number) |
Evaluates the hyperbolic sine of a number.
| sixth : ((listof Y) -> Y) |
Selects the sixth item of a non-empty list.
Evaluates the square of a number.
| sqrt : (number -> number) |
Evaluates the square root of a number.
Builds a string of the given characters.
Converts a string into a list of characters.
Converts a string into a number, produce false if impossible.
Converts a string into a symbol.
Juxtaposes the characters of several strings.
Determines whether one string alphabetically precedes another (or is equal to it) in a case-insensitive manner.
Determines whether one string alphabetically precedes another in a case-insensitive manner.
Compares two strings character-wise in a case-insensitive manner.
Determines whether one string alphabetically succeeds another (or is equal to it) in a case-insensitive manner.
Determines whether one string alphabetically succeeds another in a case-insensitive manner.
Determines the length of a string.
Extracts the i-the character from a string.
| string<=? : (string string string ... -> boolean) |
Determines whether one string alphabetically precedes another (or is equal to it).
| string<? : (string string string ... -> boolean) |
Determines whether one string alphabetically precedes another.
| string=? : (string string string ... -> boolean) |
Compares two strings character-wise.
| string>=? : (string string string ... -> boolean) |
Determines whether one string alphabetically succeeds another (or is equal to it).
| string>? : (string string string ... -> boolean) |
Determines whether one string alphabetically succeeds another.
Determines whether a value is a string.
Determines whether some value is a structure.
| sub1 : (number -> number) |
Evaluates a number one smaller than a given number.
Extracts the substring starting at a 0-based index up to the second 0-based index (exclusive).
Converts a symbol to a string.
Determines whether two symbols are equal.
Determines whether some value is a symbol.
Evaluates the tangent of a number (radians).
| third : ((cons W (cons Z (cons Y (listof X)))) -> Y) |
Selects the third item of a non-empty list.
| zero? : (number -> boolean) |
Determines if some value is zero or not.
5 Acknowledgements
WeScheme uses code and utilities from the following external projects:
The following folks have helped tremendously in the implementation of
WeScheme by implementing libraries, giving guidence, reporting bugs,
and suggesting improvements.
Brendan Hickley
Emmanuel Schanzer
Ethan Cecchetti
Guillaume Marceau
Kathi Fisler
Matthew Flatt
Robby Findler
Scott Newman
Shriram Krishnamurthi
Will Zimrin
Zhe Zhang
Please send any bug reports to Danny Yoo (dyoo@hashcollision.org).