...
Exercises: Using built-in data#Try
- 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?
...
- 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
which takes in two numbersCode Block within-two?
m
andn
, and returns true if
m - n
and {{ n - m}} are both
less than2
.
Otherwise, it should return false.
(For learning purposes only, don't use
,Code Block abs
which computes the absolute value. Also, don't use
orCode Block cond
.)Code Block if
Your examples can look likeCode Block (boolean=? (within-two? 99.8 101) true) (boolean=? (within-two? 5 -5) false)
...
Other Basics
...