![]() |
![]() |
|
home—info—lectures—exams—archive
The steps of design recipe (taken from How to Design Programs). 1. Data Def'n 2. Examples of Data 3. Template for functions handling the data 4a Write function header b Write function comments c Write test cases d Write function body i. a cond line for each variant of union data ii. pull out fields for each line handling a struct iii. add natural-recursion call, if present. 5. run tests ; num-too-long : (-> (list-of animal) natnum) ; Count how many animals in the list are too long. ; grow-all : (-> (list-of animal) (list-of animal)) ; Return a list with all the animals grown. ; find-all-long : (-> (list-of animal) natnum) ; Count how many animals in the list are too long.
Further self-practice: ; add-at-end (sometimes called 'snoc') ; reverse What is running time? Memory usage? We'll revisit these topics!
home—info—lectures—exams—archive
©2008, Ian Barland, Radford University Last modified 2008.Sep.19 (Fri) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |