Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Exercises: Using built-in data#Try

  1. Try calling some the built-in operations like <=, =, and, or, not, equal? on various data values, e.g., is 17 times 18 bigger than 256?

...

  1. What are the contracts of these built-in functions?
    *Choose any two, and write down the contract.
    *Verify your guess by asking the labby
    or by using DrScheme's Help Desk to look at the
    manual for the Beginning Student language.
    *Practice writing a function which returns a Boolean:
    Following the design recipe,
    write
    Code Block
    within-two?
    which takes in two numbers
    m and n, and returns true if
    m - n and {{ n - m}} are both
    less than 2.
    Otherwise, it should return false.
    (For learning purposes only, don't use
    Code Block
    abs
    ,
    which computes the absolute value. Also, don't use
    Code Block
    cond
    or
    Code Block
    if
    .)
    Your examples can look like
    Code Block
    
    
         (boolean=? (within-two? 99.8 101) true)
         (boolean=? (within-two? 5 -5)     false)
                

Sample solution

...

Other Basics

...