Fundamentals of Computer Science I (CS151.01 2006F)
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
[Glance]
[Search]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Homework]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Projects]
[Readings]
Reference:
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151.02 2006F (Davis)]
[CSCS151 2005S (Stone)]
[CSC151 2003F (Rebelsky)]
[CSC153 2004S (Rebelsky)]
Back to Drawing with Script-Fu. On to Discussion of Exam 2.
This outline is also available in PDF.
Held: Friday, 3 November 2006
Summary: Today we revisit some of the important behind-the-scenes issues that this week's readings covered.
Related Pages:
Due
Notes:
Trogdor!references, I'm going to try to show the background video. You can also read some background information.
Overview:
(define hyp (lambda (a b) (sqrt (+ (* a a) (* b b)))))
(define count-smoking (lambda (s1 s2) (if (equal? (smokes? s1) (smokes s2)) 1 0)))
(define count-bedtime (lambda (s1 s2) (if (equal? (get-bedtime s1) (get-bedtime s2)) 1 0)))
(define count-attribute (lambda (get-attribute) (lambda (s1 s2) (if (equal? (get-attribute s1) (get-attribute s2)) 1 0))))
(define count-smoking (count-attribute smokes?))
(define count-bedtime (count-attribute get-bedtime))
(if (>= (+ ((count-attribute smokes?) s1 s2) ((count-attribute get-bedtime) s1 s2) ...) 3) ...)
(lambda (params) body)
(define redder
(lambda (amt)
(lambda (color)
(rgb ...))))
compose
(define compose
(lambda (f g)
(lambda (x)
(f (g x)))))
(compose sin sqrt)
(compose car reverse)
left-section
(define left-section
(lambda (func left)
(lambda (right)
(func left right))))
(define l-s left-section)
(l-s + 2)
(l-s * 2)
(define right-section
(lambda (func right)
(lambda (left)
(func left right))))
(define r-s right-section)
(define smokes? (r-s vector-ref 3))
(define scale-grades
(lambda (grades)
(if (null? grades)
null
(cons (* 4/3 (car grades))
(scale-grades (cdr grades))))))
(define fixed-grades (scale-grades original-grades))
(define extra-credit
(lambda (grades)
(if (null? grades)
null
(cons (+ 7 (car grades))
(extra-credit (cdr grades))))))
(define map
(lamda (fun lst)
(if (null? lst)
null
(cons (fun (car lst))
(map fun (cdr lst))))))
(define scale-grades
(lambda (grades)
(map (lambda (grade) (* 4/3 grade)) grades)))
(define extra-credit
(lambda (grades)
(map (lambda (grade) (+ 7 grade)) grades)))
l-s
(define scale-grades
(lambda (grades)
(map (l-s * 4/3) grades)))
(define extra-credit
(lambda (grades)
(map (l-s + 7) grades)))
(define scale-grades (l-s map (l-s * 4/3)))
(define extra-credit (l-s map (l-s + 2)))
(define list-of-numbers?
(lambda (lst)
(or (null? lst)
(and (pair? lst)
(real? (car lst))
(list-of-numbers? (cdr lst))))))
(define list-of-symbols?
(lambda (lst)
(or (null? lst)
(and (pair? lst)
(symbol? (car lst))
(list-of-symbols? (cdr lst))))))
(define list-of?
(lambda (test? lst)
(or (null? lst)
(and (pair? lst)
(test? (car lst))
(list-of? test? (cdr lst))))))
(define valid-form? (lambda (val) (and (pair? val) (string? (car val)) (integer? (cdr val))))) (define all-valid? (lambda (lst) (list-of? valid-form? lst)))
(define all-valid? (l-s list-of? valid-form?))
(define all-valid? (l-s list-of? (lamda (val) (and (pair? val) (string? (car val)) (integer? (cdr val))))))
Back to Drawing with Script-Fu. On to Discussion of Exam 2.
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
[Glance]
[Search]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Homework]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Projects]
[Readings]
Reference:
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151.02 2006F (Davis)]
[CSCS151 2005S (Stone)]
[CSC151 2003F (Rebelsky)]
[CSC153 2004S (Rebelsky)]
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 Thu Nov 30 21:43:32 2006.
The source to the document was last modified on Mon Sep 4 08:43:35 2006.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2006F/Outlines/outline.37.html.
You may wish to
validate this document's HTML
;
;
http://creativecommons.org/licenses/by-nc/2.5/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.