[CP104] - Midterm Exam Guide - Comprehensive Notes for the exam (49 pages long!)

1160 views49 pages
School
Course
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Document Summary

Using recursion in a complicated situation, namely writing functions that consue 2 lists (or 2 data types, each of which has a recursive function) Case 1: a list going along for the ride. My-append (built-in) consumes 2 lists list1 and list2 and produces the list with empty in list1 replaced by list2. The function append is a built-in function that consumes 2 or more lists. Careful not to use (append (list 3) my-list) Use append only when the first list has length greater than one or when there are more than 2 lists to join together. We need to process individual elements of list1, but not list2. Total-value determines the total value of items sold, given prices of items and numbers of each item. Example: the total of prices (1 2 3) and numbers (4 5 6) is 1*4 + 2*5 + 3*6 = 32.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents