Fundamentals of CS I (CS151 2002F)
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaenous:
[Scheme Reference]
[CS151 2002F Gum]
[CS151 2001S]
[SamR]
[Glimmer Labs]
[schemers.org]
Back to Conditionals Lab. On to Characters and Strings.
Held Friday, September 13, 2002
Summary
Today we pause for a day to consider issues in the design of Scheme procedures and to help resolve any confusions you may have over past labs.
Assignments
Notes:
Overview
(car lst)
(car (cdr lst))
(cdr (cdr lst))
(cons first-element reduced-list)
(cons second-element previous-list)
(define swap-first-two
(lambda (lst)
(cons (car (cdr lst))
(cons (car lst)
(cdr (cdr lst))))))
(between a b c) should
return true (#t) if b is strictly between a and
c and false otherwise.
(define between
(lambda (a b c)
(cond
((and (< a b) (< b c)) #t)
((and (> a b) (> b c)) #t)
(else #f))))
ands,
just use three parameters.
(define between
(lambda (a b c)
(cond
((< a b c) #t)
((> a b c) #t)
(else #f))))
If an expression is true, use true.Since the value returned is the same as the value of the expression, why not just use that?
(define between
(lambda (a b c)
(or (< a b c) (> a b c))))
exact->inexact, can you define a value, v,
such that v is an integer and v is inexact. E.g.,
> (define v ...) > (integer? v) #t > (exact? v) #f
Are there other problems you've encountered in recent labs?
Thursday, 29 August 2002
Wednesday, 11 September 2002
Friday, 13 September 2002
Back to Conditionals Lab. On to Characters and Strings.
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaenous:
[Scheme Reference]
[CS151 2002F Gum]
[CS151 2001S]
[SamR]
[Glimmer Labs]
[schemers.org]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Dec 2 08:40:57 2002.
The source to the document was last modified on Fri Sep 13 08:42:32 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2002F/Outlines/outline.09.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby