|
University of Virginia Computer Science CS150: Computer Science, Fall 2005 |
(none) 9 September 2005 |
Recursive Definitions
(define (find-closest goal numbers)
(if (= 1 (length numbers))
(first numbers)
(if (< (abs (- goal (first numbers)))
(abs (- goal
(find-closest goal (rest numbers)))))
(first numbers)
(find-closest goal (rest numbers))))
Languages
How can we compare notations for describing languages?
What is the difference between RTN and BNF?
Music and Recursion
Song ::= Verse VBBD VBBD Better CodaChallenge Problem
VBBD ::= Verse Bridge Bridge Dadada (ends on C)
Coda ::= F Eb Bb F Coda
Note: the Coda has no base case, and should continue forever (time permitting).
Links
Hofstadter's Law: It always takes longer than you expect, even when you
take Hofstadter's Law into account.
CS150 Law: Problem Sets always take longer than you expect, even when you take the CS150 Law into account.
| "); print ( $res[$first] ) ; print (" |
|
CS 150: Computer Science University of Virginia |
evans@virginia.edu Using these Materials |