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 Emma Youndtsmith, Emmanuel Schanzer, Kathi Fisler, Shriram Krishnamurthi, Joe Politz and Dorai Sitaram is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.