; Sharon Tuttle and S. Tuttle
; (put your names in a comment)

; week 1 lab
; 2016-08-26

; simple expression of type number

13

; simple expression of type string

"chicken wings"

; simple expression of type boolean

#true

; simple expression of type image

image of dachshund curled into a spiral

; reminder: compound expressions in BSL Racket

; (operation expression ... )

(+ 3 5 7 9)

(+ 3
   (+ 5 7)
   9)

; NOTE: Racket has named functions as many of
;    its operations...
; NOTE: a given operation expects a certain number
;    of expressions, of specific types
; NEW THING: the expressions after the operation
;    in a compound expression are called its
;    ARGUMENTS

; NEW THING: the type of a compound expression
;   is the type of the value it results in/returns

; this is a compound expression of type number

(+ 3 5)

; Racket has several arithmetic operations

; + - * /

(+ (* 3 5)
   (/ 3 5)
   (- 3 5))

; it also has numerous built in function operations

; sqrt ceiling floor round 

; + - * / expect 2 or more number expressions and\
;    return a number result (the result of doing
;    that operation on those arguments)

; sqrt expects exactly one number argument
;    and returns a number, the square root of
;    its argument

(sqrt 100)

(ceiling 3.1)

(floor 3.999)

; here are some built-in functions involving strings

; string-append expects zero or more string arguments
;    and returns a string that is all those string
;    arguments' values smushed together

(string-append "moo" "cow")
(string-append "a" "lp" "ha")
(string-append "go")
(string-append)

; string? is a predicate -- it expects any expression,
;    and returns whether or not it is of type string

(string? "go")
(string? (string-append))
(string? 5)

(string? "5")

; yes, there are also predicates number? image? and
;   boolean?

; string=? expects two string arguments and returns
;   whether those two strings have the same value

(string=? "moo" 
          (string-append "m" "o" "o"))

; there is also = and boolean=? and image=?

; you can turn a number into a string equivalent
;   with string->number
; (and if appropriate, vice versa with
;   number->string

(string->number "13")
(string->number "moo")
(number->string 134)

; DrRacket provides modules and teachpacks of
;   useful functions and goodies
; BSL Racket has two we especiallt want:

; 2htdp/image
; 2htdp/universe

; you make them available with a require expression

(require 2htdp/image)
(circle 30 "solid" "purple")
(rectangle 30 50 "outline" "purple")

(overlay
   (circle 30 "solid" "purple")
   (rectangle 30 90 "outline" "red"))