[Current] [News] [Glance] [Discussions] [Instructions] [Search] [Links] [Handouts] [Outlines] [Readings] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [Fall2000.01] [Spring2000]
not
?
not
? Revisited
You may want to refer to the reading on Boolean values and predicates and the reading on numbers before or while you work on this lab.
a. If you haven't done so already, you may wish to skim the readings.
b. Start DrScheme.
Fill in the following table (or as much as you think is appropriate)
5  5.0  'five  "five"  list  #t  #f  (cons 'a null)  null  'null  ()  
number? 

symbol? 

string? 

procedure? 

boolean? 

list? 
Which of the following does Scheme consider an empty list?
null
'null
()
(list a)
(list)
'nothing
Consider the following definitions
(define alpha (list 'a 'b 'c)) (define beta (list 'a 'b 'c)) (define gamma alpha)
Determine which of the lists are eq?
, eqv?
,
or equal?
.
Did you see anything surprising in the previous exercises?
not
?
a. What type is not
?
b. What predicate would you use to verify your answer?
not
? Revisited
The symbol not
is the name of something, as you
determined in the preceding exercise.
However, the symbol itself, considered as a datum, is
not a procedure. Does Scheme agree with this classification? How
could one ask Scheme whether the symbol not
is a
procedure?
Fill in the following tables for each of the operations and
and or
.
and
First argument  Second argument  Result 
#f 
#f 

#f 
#t 

#t 
#f 

#t 
#t 
or
First argument  Second argument  Result 
#f 
#f 

#f 
#t 

#t 
#f 

#t 
#t 
a. Write a Boolean expression that determines if the value named by
grade
is between 0 and 100, inclusive.
b. Test that expression using different values of grade
.
Have DrScheme confirm that 3/4 is a rational number but not an integer and that the square root of 1 is a complex number but not a real number.
Confirm that the value DrScheme computes for (sqrt 2)
is an
inexact real that is also rational.
As you've just seen, some kinds of numbers are subsets of other kinds of numbers. Determine the relationships between the various kinds of numbers.
Write a Scheme numeral for 1.507 times ten to the fifteenth power, as an exact number. Have Scheme evaluate the numeral.
a. Have DrScheme find the square of the square root of 2 and subtract 2 from the result.
b. Ideally, the difference should be 0; why isn't it?
c. How big is the difference?
d. Will you have the same problem if you start with 4? Why or why not?
Write a Scheme numeral for onethird, as an inexact number. Have Scheme evaluate the numeral.
Today's lab currently lacks notes.
[Current] [News] [Glance] [Discussions] [Instructions] [Search] [Links] [Handouts] [Outlines] [Readings] [Labs] [Homeworks] [Quizzes] [Exams] [Examples] [Fall2000.01] [Spring2000]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2000F/Labs/basictypes.html
Source text last modified Wed Sep 13 10:50:27 2000.
This page generated on Fri Sep 15 10:15:11 2000 by Siteweaver. Validate this page's HTML.
Contact our webmaster at rebelsky@grinnell.edu