Admin

Problems 1 - 10

8/24  Basic Racket Expressions 

  • Review math expressions 
  • Ex 1-3 video
    • 1 - copy the definitions for x & y. Write the mathematical formula (expression) in Racket. Change x and y to 5 and 12, and the expression should then give you 13.
    • 2  if prefix or suffix is changed, your answer should change.  Example (define prefix "small") would give "small_world"
    • 3 Cut the string at the i position. IMPORTANT! If i is changed, the strings will be cut at a different position! Then rejoin with the "_" between them.
  •  Ex 4-6 video
    • 4 Almost the same as #3. However, when you cut the string, cut up to the letter that you don't want. For the second string, cut just past the letter that you don't want.
    • images - overlay and overlay/xy video
    • 5 create 3 simple pictures, that a 4 year old would identify as a car, tree, & boat. This tree is a bit fancy.  A simple green triangle is fine.  As you do these image problems, keep the images simple!  Make the tree with just one triangle (3 are shown).


8/28  Images, booleans, branching, and nested branching

  • quiz math expressions 
  • exercises 1 - 5 due
  • 6  Recall that images are rectangles and the area of a rectangle is .... 
  • 7  Here is an alternate problem that you can use (but you can also use the one in the book)

(define  weekday  #true)
(define  vacation  #true)
Write an expression that will correctly identify if the person can sleep in.
Answering the following question may help you.

      You can sleep in if ... weekday ... vacation...   [ use two of the following:  and  or  not ]

There are four possible combinations of boolean values for this problem and the expression should give the correct answer for any of these combinations.

weeday vacation  sleep in 
 #true  #true  #true
 #true  #false #false
#false  #true  #true
 #false  #false  #true


Ex. 7 video
Ex. 7 alternate problem Video  (sleep-in  vacation  weekday)


9/4

Predicates 

  • 8  write one expression for this problem that gives "tall"  and  "not tall". Then write a second expression that gives "tall" "wide" or "square"

nested if part 1 (vote or can't vote)   (number is positive, negative, or zero)

nested if part 2 (traffic light : red, green, yellow)   (gravel : large, medium, small, sand )

if video - one example  (minor, vote, drink)


9/6

  • 9  test (change) in to the following cases (solutions).  Each time that you change in your expression will give you the correct result.  It will also give the correct result for other expressions.  You may use several "predicates". These are functions that tell you #true or #false depending on the type of data. Predicates for the four types of data we have learned so far, are: (number? ...)   (string? ... )   (image? ... )    (boolean?   ... )
    • (define in "scrumptious")  11
    • (define in  (rectangle 20 10 "solid" "red"))  200
    • (define in  (circle 10 "solid" "green"))  400
    • (define in  17)  16
    • (define in  23)  22
    • (define in  0)  0
    • (define in  -5)  -5
    • (define in  #true)  10
    • (define in  #false)  20

 

 

 

Website by SchoolMessenger Presence. © 2018 West Corporation. All rights reserved.