Fundamentals of Computer Science I (CS151 2003F)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Guidelines for Lab Writeups]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[Scheme Report]
[Glimmer Scheme Reference]
[CSC151.01 (Gum)]
[CSC151 2003S]
[CSC151 2002F]
[SamR]
Back to Pairs and Pair Structures. On to Early Break.
Held: Thursday, 16 October 2003
Summary:
Today we consider a variant of recursion known as deep recursion.
In this variant, you often recurse in multiple directions
, particularly into the car of each pair as well as into the cdr of each pair.
Related Pages:
Assignments
Notes:
Overview:
count-elements.depth.cons, car, cdr, null, and null?.
listp?, we thought about the list as a recursively-defined data structure. A list is either
(define procname
(lambda (lst)
(if (null? lst)
base-case
(combine (car lst) (procname (cdr lst))))))
do-something usually does something fairly simple
with the combination of the car and the recursive call.
commonproblems and algorithms for which deep recursion is an appropriate technique.
lengthlength
is that it does not count the values in sublists when determining
the length of the list. Hence, the length of the list
((1 2 3)) is 1, rather than the 3 that most people
might expect.
(list null null null)
Back to Pairs and Pair Structures. On to Early Break.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Guidelines for Lab Writeups]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[Scheme Report]
[Glimmer Scheme Reference]
[CSC151.01 (Gum)]
[CSC151 2003S]
[CSC151 2002F]
[SamR]
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 Tue Dec 9 13:59:47 2003.
The source to the document was last modified on Mon Sep 1 13:30:51 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003F/Outlines/outline.29.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby