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, add another line in the definitions window:
(bitmap/url "http://racket-lang.org/logo.png")
Press the Run button again. We should now see an image in the Interactions window as well.
(rotate 45 (bitmap/url "http://racket-lang.org/logo.png"))
(overlay (bitmap/url "http://racket-lang.org/logo.png") (bitmap/url "http://www.wescheme.org/css/images/BigLogo.png"))
3 World programming and Images API
procedure
(big-bang w h ...) → world
w : world h : big-bang-handler
procedure
(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)
;; The world is a number ;; tick: world -> world (define (tick world) (add1 world)) (big-bang 0 (on-tick tick 2)) ;; tick every two seconds
procedure
(on-key key-f) → big-bang-handler
key-f : ([w world] [k key] -> world)
;; 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))
procedure
(to-draw draw-f) → big-bang-handler
draw-f : ([w world] -> image)
;; 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.
procedure
(stop-when stop?) → big-bang-handler
stop? : ([w world] -> boolean)
;; the world is a number ;; stop?: world -> boolean (define (stop? world) (> world 10)) (big-bang 0 (stop-when stop?) (on-tick add1 1))
Here is a listing of the functions you can use to make images.
struct
(struct color (red green blue alpha) #:extra-constructor-name make-color) 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 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.
procedure
(empty-scene width height) → image?
Example: |
||
|
The three-argument version creates a rectangle of the specified color with a black outline.
procedure
(scene+line image x1 y1 x2 y2 color) → image?
Examples: |
||||||||
|
procedure
(place-image/align image x y x-place y-place scene) → image? image : image? x : real? y : real? x-place : x-place? y-place : y-place? scene : image?
Examples: |
|||||||||||||||||||||||
|
procedure
Examples: |
||||||
|
procedure
Example: |
||
|
procedure
(radial-star point-count inner-radius outer-radius mode color) → image? point-count : (and/c integer? (>=/c 2)) inner-radius : (and/c real? (not/c negative?)) outer-radius : (and/c real? (not/c negative?)) mode : mode? color : image-color?
(radial-star point-count inner-radius outer-radius outline-mode color) → image? point-count : (and/c integer? (>=/c 2)) inner-radius : (and/c real? (not/c negative?)) outer-radius : (and/c real? (not/c negative?)) outline-mode : (or/c 'outline "outline") color : image-color?
Examples: |
||||
|
procedure
(star-polygon side-length side-count step-count mode color) → image? side-length : (and/c real? (not/c negative?)) side-count : side-count? step-count : step-count? mode : mode? color : image-color?
(star-polygon side-length side-count step-count outline-mode color) → image? side-length : (and/c real? (not/c negative?)) side-count : side-count? step-count : step-count? outline-mode : (or/c 'outline "outline") color : image-color?
For example, if side-count is 5 and step-count is 2, then this function produces a shape just like star.
Examples: |
||||||
|
Examples: |
|||||||||||||||||||
|
procedure
Examples: |
||||||||||||||||||||
|
procedure
(rectangle | width | |||||
height | ||||||
outline-mode | ||||||
color) | → | image? |
Examples: |
||||
|
procedure
(regular-polygon side-length side-count mode color) → image? side-length : (and/c real? (not/c negative?)) side-count : side-count? mode : mode? color : image-color?
(regular-polygon side-length side-count outline-mode color) → image? side-length : (and/c real? (not/c negative?)) side-count : side-count? outline-mode : (or/c 'outline "outline") color : image-color?
Examples: |
||||||
|
procedure
(rhombus | side-length | |||||
angle | ||||||
outline-mode | ||||||
color) | → | image? |
Examples: |
||||
|
procedure
Examples: |
||||
|
procedure
(triangle | side-length | |||||
outline-mode | ||||||
color) | → | image? |
Example: |
||
|
procedure
(right-triangle side-length1 side-length2 mode color) → image? side-length1 : (and/c real? (not/c negative?)) side-length2 : (and/c real? (not/c negative?)) mode : mode? color : image-color?
(right-triangle side-length1 side-length2 outline-mode color) → image? side-length1 : (and/c real? (not/c negative?)) side-length2 : (and/c real? (not/c negative?)) outline-mode : (or/c 'outline "outline") color : image-color?
Example: |
||
|
procedure
(isosceles-triangle side-length angle mode color) → image? side-length : (and/c real? (not/c negative?)) angle : angle? mode : mode? color : image-color?
(isosceles-triangle side-length angle outline-mode color) → image? side-length : (and/c real? (not/c negative?)) angle : angle? outline-mode : (or/c 'outline "outline") color : image-color?
Examples: |
||||||
|
-
triangle/sss, if all three sides are known
-
triangle/ass, triangle/sas, or triangle/ssa, if two sides and their included angle are known
-
triangle/aas, triangle/asa, or triangle/saa, if two angles and their shared side are known.
They all construct a triangle oriented as follows:
procedure
Examples: |
||||||
|
Examples: |
||||||
|
Examples: |
||||||||
|
Examples: |
|||||||||||||||||||
|
This is the same as (underlay/xy i2 (- x) (- y) i1).
See also overlay/offset and underlay/offset.
Examples: |
|||||||||||||||||||||||||
|
procedure
(overlay/align x-place y-place i1 i2 is ...) → image?
Examples: |
||||||||||||
|
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.
Examples: |
||||||||||||||||||||
|
This is the same as (overlay/xy i2 (- x) (- y) i1).
See also underlay/offset and overlay/offset.
Examples: |
|||||||||||||||||||||||||
|
procedure
(underlay/align x-place y-place i1 i2 is ...) → image?
Examples: |
|||||||||||||||||||
|
Example: |
||||||
|
procedure
(beside/align y-place i1 i2 is ...) → image?
Examples: |
|||||||||||||||||||
|
Example: |
||||||
|
procedure
(above/align x-place i1 i2 is ...) → image?
Examples: |
||||||||||||||
|
Examples: |
|||||||||||
|
Examples: |
||||
|
Examples: |
|||||||
|
procedure
Examples: |
|||||||||||
|
Example: |
||
|
Generally speaking, this function is useful to debug image constructions, i.e., to see where certain sub-images appear within some larger image.
Example: |
|||||||
|
procedure
(flip-horizontal image) → image?
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).
Example: |
||||||
|
procedure
(flip-vertical image) → image?
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).
Example: |
|||||
|
Examples: |
||||
|
procedure
(text/font string font-size color face family style weight underline?) → image? string : string? font-size : (and/c integer? (<=/c 1 255)) color : image-color? face : (or/c string? #f) family : (or/c 'default 'decorative 'roman 'script 'swiss 'modern 'symbol 'system) style : (or/c 'normal 'italic 'slant) weight : (or/c 'normal 'bold 'light) underline? : any/c
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: |
||||||||||||
|
procedure
(bitmap/url url) → image?
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%.
Examples: |
||||||||||
|
Examples: |
||||||||||
|
procedure
(image->color-list image) → (listof color?)
Examples: |
|||||||||
|
procedure
(color-list->image l width height x y) → 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.
Unless the image was constructed with text, text/font or, in some cases, crop, this will be the same as its height.
Examples: |
||||||||
|
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.
Examples: |
||||||||||||
|
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.
procedure
(image-color? x) → boolean?
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<%>.
Using "pinhole" or 'pinhole is only allowed when all of the image arguments have pinholes.
Using "pinhole" or 'pinhole is only allowed when all of the image arguments have pinholes.
See also image-baseline for more discussion of baselines.
procedure
(side-count? x) → boolean?
procedure
(step-count? x) → boolean?
4 Basic operations
syntax
(check-expect expression expected-expression)
(check-expect (+ 1 2) 3)
procedure
(* x ...) → number
> (* 5 3) 15
> (* 5 3 2) 30
> (* 2) 2
> (*) 1
procedure
(+ x ...) → number
> (+ 2/3 1/16) 35/48
> (+ 3 2 5 8) 18
> (+ 1) 1
> (+) 0
> (- 5) -5
> (- 5 3) 2
> (- 5 3 1) 1
> (< 42 2/5) false
> (<= 42 2/5) false
> (= 42 2/5) false
> (=~ 1.01 1.0 0.1) true
> (=~ 1.01 1.5 0.1) false
> (> 42 2/5) true
> (>= 42 42) true
> (and true false) false
> (or true false) true
procedure
(acos x) → number
> (acos 0) #i1.5707963267948966
(andmap p (list x-1 ... x-n)) = (and (p x-1) ... (p x-n))
> (andmap odd? '(1 3 5 7 9)) true
> threshold 3
> (andmap (lambda (x) (< x threshold)) '(0 1 2)) true
> (andmap even? '()) true
procedure
(angle x) → real
> (angle (make-polar 3 4)) #i-2.2831853071795867
procedure
(append l ...) → (listof any)
procedure
(asin x) → number
> (asin 0) 0
> (atan 0) 0
> (atan 3 4) #i0.6435011087932844
> (boolean=? true false) false
procedure
(boolean? x) → boolean?
> (boolean? 42) false
> (boolean? false) true
(build-list n f) = (list (f 0) ... (f (- n 1)))
> (build-list 22 add1) (list 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22)
> i 3
> (build-list 3 (lambda (j) (+ j i))) (list 3 4 5)
> (build-list 5 (lambda (i) (build-list 5 (lambda (j) (if (= i j) 1 0)))))
(list
(list 1 0 0 0 0)
(list 0 1 0 0 0)
(list 0 0 1 0 0)
(list 0 0 0 1 0)
(list 0 0 0 0 1))
procedure
(caaar x) → any/c
> w (list (list (list (list "bye") 3) true) 42)
> (caaar w) (list "bye")
procedure
(caadr x) → any/c
> z (list (list (list (list 'a 'b) 2 3)) (list false true) "world")
> (caadr z) false
procedure
(caar x) → any/c
> y (list (list (list 1 2 3) false "world"))
> (caar y) (list 1 2 3)
procedure
(cadar x) → any/c
> w (list (list (list (list "bye") 3) true) 42)
> (cadar w) true
procedure
(cadddr x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (cadddr v) 4
procedure
(caddr x) → any/c
> x (list 2 "hello" true)
> (caddr x) true
procedure
(cadr x) → any/c
> x (list 2 "hello" true)
> (cadr x) "hello"
procedure
(car x) → any/c
> x (list 2 "hello" true)
> (car x) 2
procedure
(cdaar x) → any/c
> w (list (list (list (list "bye") 3) true) 42)
> (cdaar w) (list 3)
procedure
(cdadr x) → any/c
> z (list (list (list (list 'a 'b) 2 3)) (list false true) "world")
> (cdadr z) (list true)
procedure
(cdar x) → list?
> y (list (list (list 1 2 3) false "world"))
> (cdar y) (list false "world")
procedure
(cddar x) → any/c
> w (list (list (list (list "bye") 3) true) 42)
> (cddar w) empty
procedure
(cdddr x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (cdddr v) (list 4 5 6 7 8 9 'A)
procedure
(cddr x) → list?
> x (list 2 "hello" true)
> (cddr x) (list true)
procedure
(cdr x) → any/c
> x (list 2 "hello" true)
> (cdr x) (list "hello" true)
procedure
(ceiling x) → integer
> (ceiling 12.3) #i13.0
procedure
(char->integer c) → integer
> (char->integer #\a) 97
> (char->integer #\z) 122
procedure
(char-alphabetic? c) → boolean?
> (char-alphabetic? #\Q) true
> (char-ci<=? #\b #\B) true
> (char<=? #\b #\B) false
> (char-ci<? #\B #\c) true
> (char<? #\b #\B) false
> (char-ci=? #\b #\B) true
> (char-ci>=? #\b #\C) false
> (char>=? #\b #\C) true
> (char-ci>? #\b #\B) false
> (char>? #\b #\B) true
procedure
(char-downcase c) → char
> (char-downcase #\T) #\t
procedure
(char-lower-case? c) → boolean?
> (char-lower-case? #\T) false
procedure
(char-numeric? c) → boolean?
> (char-numeric? #\9) true
procedure
(char-upcase c) → char
> (char-upcase #\t) #\T
procedure
(char-upper-case? c) → boolean?
> (char-upper-case? #\T) true
procedure
(char-whitespace? c) → boolean?
> (char-whitespace? #\tab) true
> (char<=? #\a #\a #\b) true
> (char<? #\a #\b #\c) true
> (char=? #\b #\a) false
> (char>=? #\b #\b #\a) true
> (char>? #\A #\z #\a) false
procedure
(char? x) → boolean?
procedure
(complex? x) → boolean?
> (real? 1-2i) false
procedure
(conjugate x) → number
> (conjugate (make-polar 3 4)) #i-1.960930862590836+2.2704074859237844i
procedure
(cons? x) → boolean?
> (cons? (cons 1 empty)) true
> (cons? 42) false
procedure
(cosh x) → number
> (cosh 10) #i11013.232920103324
procedure
(current-seconds) → integer
> (current-seconds) 1359841903
procedure
(denominator x) → integer
> (denominator 2/3) 3
procedure
(eighth x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (eighth v) 8
value
empty : empty?
procedure
(empty? x) → boolean?
> (empty? empty) true
> (empty? 42) false
procedure
(eof-object? x) → boolean?
> (eof-object? eof) true
> (eof-object? 42) false
> (eq? (cons 1 empty) (cons 1 empty)) false
> one (list 1)
> (eq? one one) true
> (equal? (make-posn 1 2) (make-posn (- 2 1) (+ 1 1))) true
> (equal~? (make-posn 1.01 1.0) (make-posn 1.01 0.99) 0.2) true
> (eqv? (cons 1 empty) (cons 1 empty)) false
> one (list 1)
> (eqv? one one) true
procedure
(error x ...) → void?
> zero 0
> (if (= zero 0) (error "can't divide by 0") (/ 1 zero)) can't divide by 0
procedure
(even? x) → boolean?
> (even? 2) true
procedure
(exact->inexact x) → number
> (exact->inexact 12) #i12.0
procedure
(exp x) → number
> (exp -2) #i0.1353352832366127
> (expt 16 1/2) 4
> (expt 3 -4) 1/81
value
false : boolean?
procedure
(false? x) → boolean?
> (false? false) true
procedure
(fifth x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (fifth v) 5
procedure
(first x) → any/c
> x (list 2 "hello" true)
> (first x) 2
procedure
(floor x) → integer
> (floor 12.3) #i12.0
(foldl f base (list x-1 ... x-n)) = (f x-n ... (f x-1 base))
> (foldl + 0 '(0 1 2 3 4 5 6 7 8 9)) 45
> a-list (list 0 1 2 3 4 5 6 7 8 9)
> (foldl (lambda (x r) (if (> x threshold) (cons (* 2 x) r) r)) '() a-list) (list 18 16 14 12 10 8)
> (format "Dear Dr. ~a:" "Flatt") "Dear Dr. Flatt:"
> (format "Dear Dr. ~s:" "Flatt") "Dear Dr. \"Flatt\":"
> (format "the value of ~s is ~a" '(+ 1 1) (+ 1 1)) "the value of (+ 1 1) is 2"
procedure
(fourth x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (fourth v) 4
> (gcd 6 12 8) 2
procedure
(identity x) → any
> (identity 42) 42
> (identity c1) > (identity "hello") "hello"
procedure
(imag-part x) → real
> (imag-part 3+4i) 4
procedure
(inexact->exact x) → number
> (inexact->exact 12.0) 12
procedure
(inexact? x) → boolean?
> (inexact? 1-2i) false
procedure
(integer->char x) → char
> (integer->char 42) #\*
procedure
(integer? x) → boolean?
> (integer? (sqrt 2)) false
> (lcm 6 12 8) 24
procedure
(length l) → natural-number?
> x (list 2 "hello" true)
> (length x) 3
procedure
(list x ...) → list?
> (list 1 2 3 4 5 6 7 8 9 0)
(cons
1
(cons
2
(cons
3
(cons
4
(cons
5
(cons 6 (cons 7 (cons 8 (cons 9 (cons 0 empty))))))))))
procedure
(list->string l) → string
> (list->string (cons #\c (cons #\a (cons #\t empty)))) "cat"
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (list-ref v 9) 'A
procedure
(log x) → number
> (log 12) #i2.4849066497880004
procedure
(magnitude x) → real
> (magnitude (make-polar 3 4)) #i3.0
> (make-posn 3 3) (posn 3 3)
> (make-posn "hello" true) (posn "hello" true)
> (make-string 3 #\d) "ddd"
(map f (list x-1 ... x-n)) = (list (f x-1) ... (f x-n))
> (map add1 '(3 -4.01 2/5)) (list 4 #i-3.01 1.4)
> (map (lambda (x) (list 'my-list (+ x 1))) '(3 -4.01 2/5))
(list
(list 'my-list 4)
(list 'my-list #i-3.01)
(list 'my-list 1.4))
> (max 3 2 8 7 2 9 0) 9
> x (list 2 "hello" true)
> (member "hello" x) true
> x (list 2 "hello" true)
> (memq (list (list 1 2 3)) x) false
> x (list 2 "hello" true)
> (memv (list (list 1 2 3)) x) false
> (min 3 2 8 7 2 9 0) 0
> (modulo 9 2) 1
> (modulo 3 -4) -1
procedure
(negative? x) → boolean?
> (negative? -2) true
procedure
(not x) → boolean?
procedure
(null? x) → boolean?
> (null? empty) true
> (null? 42) false
procedure
(number->string x) → string
> (number->string 42) "42"
procedure
(number? n) → boolean?
> (number? "hello world") false
> (number? 42) true
procedure
(numerator x) → integer
> (numerator 2/3) 2
procedure
(odd? x) → boolean?
> (odd? 2) false
procedure
(positive? x) → boolean?
> (positive? -2) false
procedure
(posn-x p) → any
> p (posn 2 -3)
> (posn-x p) 2
procedure
(posn-y p) → any
> p (posn 2 -3)
> (posn-y p) -3
procedure
(posn? x) → boolean?
> q (posn "bye" 2)
> (posn? q) true
> (posn? 42) false
> (quotient 9 2) 4
> (quotient 3 4) 0
procedure
(random x) → integer
> (random) #i0.183137602892849
procedure
(rational? x) → boolean?
> (rational? 1-2i) false
procedure
(real-part x) → real
> (real-part 3+4i) 3
procedure
(real? x) → boolean?
> (real? 1-2i) false
> (remainder 9 2) 1
> (remainder 3 4) 3
procedure
(rest x) → any/c
> x (list 2 "hello" true)
> (rest x) (list "hello" true)
procedure
(reverse l) → list
> x (list 2 "hello" true)
> (reverse x) (list true "hello" 2)
procedure
(round x) → integer
> (round 12.3) #i12.0
procedure
(second x) → any/c
> x (list 2 "hello" true)
> (second x) "hello"
procedure
(seventh x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (seventh v) 7
procedure
(sgn x) → (union 1 1.0 0 0.0 -1 -1.0)
> (sgn -12) -1
procedure
(sin x) → number
> (sin pi) #i1.2246467991473532e-16
procedure
(sinh x) → number
> (sinh 10) #i11013.232874703393
procedure
(sixth x) → any/c
> v (list 1 2 3 4 5 6 7 8 9 'A)
> (sixth v) 6
procedure
(sqrt x) → number
> (sqrt 9) 3
> (sqrt 2) #i1.4142135623730951
procedure
(string c ...) → string?
> (string #\d #\o #\g) "dog"
procedure
(string->list s) → (listof char)
> (string->list "hello") (list #\h #\e #\l #\l #\o)
procedure
(string->number s) → (union number false)
> (string->number "-2.03") #i-2.03
> (string->number "1-2i") 1-2i
procedure
(string->symbol s) → symbol
> (string->symbol "hello") 'hello
procedure
(string-append s ...) → string
> (string-append "hello" " " "world" " " "good bye") "hello world good bye"
> (string-ci<=? "hello" "WORLD" "zoo") true
> (string-ci<? "hello" "WORLD" "zoo") true
> (string-ci=? "hello" "HellO") true
> (string-ci>? "zoo" "WORLD" "hello") true
> (string-ci>? "zoo" "WORLD" "hello") true
procedure
(string-length s) → nat
> (string-length "hello world") 11
> (string-ref "cat" 2) #\t
> (string<=? "hello" "hello" "world" "zoo") true
> (string<? "hello" "world" "zoo") true
> (string=? "hello" "world") false
> (string=? "bye" "bye") true
> (string>=? "zoo" "zoo" "world" "hello") true
> (string>? "zoo" "world" "hello") true
procedure
(string? x) → boolean?
> (string? "hello world") true
> (string? 42) false
procedure
(struct? x) → boolean?
> (struct? (make-posn 1 2)) true
> (struct? 43) false
procedure
(symbol->string x) → string
> (symbol->string 'c) "c"
> (symbol=? 'a 'b) false
procedure
(symbol? x) → boolean?
procedure
(tan x) → number
> (tan pi) #i-1.2246467991473532e-16
procedure
(third x) → any/c
value
true : boolean?
procedure
(zero? x) → boolean?
5 Keyboard shortcuts
- Tab - Will auto-indent the active line, based on the previous line's indentation.
- Ctrl-I - Will auto-indent the entire definitions window. (Cmd-I on Apple)
- F5 - Shortcut for the "Run" button".
- Ctrl-S - Shortcut for the "Save" button". (Cmd-S on Apple)
- Ctrl-P - When typing in the interactions window, this shortcut will re-type the previous command. (Cmd-P on Apple)
- Ctrl-N - When typing in the interactions window, this shortcut will re-type the next command. (Cmd-N on Apple)
6 Acknowledgements
-
jshashtable (http://www.timdown.co.uk/jshashtable/)
-
js-numbers (http://github.com/bootstrapworld/js-numbers/)
-
JSON (http://www.json.org/js.html)
-
jquery (http://jquery.com/)
-
Google Closure Compiler (http://code.google.com/p/closure-compiler/)
-
excanvas (http://excanvas.sourceforge.net/)
-
canvas-text (http://code.google.com/p/canvas-text/source/browse/trunk)
The following folks have helped tremendously in the implementation of WeScheme by implementing libraries, giving guidence, reporting bugs, and suggesting improvements.
-
Andrew Tian
-
Brendan Hickley
-
Daniel Kocoj
-
Emmanuel Schanzer
-
Ethan Cecchetti
-
Guillaume Marceau
-
Kathi Fisler
-
Matthew Flatt
-
Michael Rowland
-
Robby Findler
-
Scott Newman
-
Shriram Krishnamurthi
-
Will Zimrin
-
Zhe Zhang
Please send any bug reports to Emmanuel Schanzer (info@bootstrapworld.org).