Racket Code Pyret Code

3

(define SHAPE
  (triangle 40 "outline" "red"))

(define OUTLINE
  (star 80 "solid" "green"))

(define SQUARE
  (rectangle 50 50 "solid" "blue"))
SHAPE =
  triangle(40, "outline", "red")

OUTLINE =
  star(80, "solid", "green")

SQUARE =
  rectangle(50, 50, "solid", "blue")

One of your own:

4

(define BOOL true)

(define BOOL2 false)
BOOL = true

BOOL2 = false

One of your own:

5

; double : Number -> Number
; Given a number, multiply by
; 2 to double it

(EXAMPLE (double 5) (* 2 5))

(EXAMPLE (double 7) (* 2 7))

(define (double n) (* 2 n))
# double :: Number -> Number
# Given a number, multiply by
# 2 to double it

examples:
  double(5) is 2 * 5
  double(7) is 2 * 7
end

fun double(n):
  2 * n
end

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Reactive by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.