Fundamentals of Computer Science I: Media Computing (CS151.01 2008S)
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Assignment]
Groupings:
[Assignments]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Projects]
[Readings]
References:
[A-Z]
[Primary]
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151.02 2008S (Davis)]
[CSC151 2007F (Rebelsky)]
[CSC151 2007S (Rebelsky)]
[CSCS151 2005S (Stone)]
Misc:
[SamR]
[DrFu]
[GIMP]
[DrScheme]
Back to Project Ideas. On to Binary Search.
This outline is also available in PDF.
Held: Monday, 21 April 2008
Summary:
We visit the topic of higher-order procedures, one of the most
important techniques in languages like Scheme. Higher-order procedures
are procedures, like map, that take other procedures
as parameters, return other procedures as values, or both.
Related Pages:
Notes:
Overview:
map.all?.(define hyp (lambda (a b) (sqrt (+ (* a a) (* b b)))))
The following is variant of something John Stone says ...
all-real? and all-integer?
add-5-to-each and multiply-each-by-5
(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))
map is the standard example.
(define map
(lamda (fun lst)
(if (null? lst)
null
(cons (fun (car lst))
(map fun (cdr lst))))))
(define all-numbers?
(lambda (lst)
(or (null? lst)
(and (pair? lst)
(number? (car lst))
(all-numbers? (cdr lst))))))
(define all-symbols?
(lambda (lst)
(or (null? lst)
(and (pair? lst)
(symbol? (car lst))
(all-symbols? (cdr lst))))))
(define all
(lambda (test? lst)
(or (null? lst)
(and (pair? lst)
(test? (car lst))
(all test? (cdr lst))))))
Back to Project Ideas. On to Binary Search.
[Skip to Body]
Primary:
[Front Door]
[Syllabus]
-
[Academic Honesty]
[Instructions]
Current:
[Outline]
[EBoard]
[Reading]
[Lab]
[Assignment]
Groupings:
[Assignments]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Projects]
[Readings]
References:
[A-Z]
[Primary]
[Scheme Report (R5RS)]
[Scheme Reference]
[DrScheme Manual]
Related Courses:
[CSC151.02 2008S (Davis)]
[CSC151 2007F (Rebelsky)]
[CSC151 2007S (Rebelsky)]
[CSCS151 2005S (Stone)]
Misc:
[SamR]
[DrFu]
[GIMP]
[DrScheme]
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 Sat Apr 19 21:28:51 2008.
The source to the document was last modified on Thu Jan 17 16:44:18 2008.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2008S/Outlines/outline.44.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.