EECS 111 Lecture 14: Debugging 1

41 views2 pages

Document Summary

Common error message: expected a function after the open parenthesis, but received (list 1 2 3) (define (nest list) (list list)) There is shadowing happening here (when a locally defined expression blocks the execution of a globally defined expression) Must do (define (nest lst) (list lst)) (define (avg lst) (/ (foldr + 0 lst) (length lst))) (apply + (list 1 2 3)) identical to (+ (list 1 2 3)) Apply: takes a procedure and a list and applies the procedure over the list (append (list 1 2) (list 4 5)) (apply append (list (list 1 2) (list 3 4) (list 5 6))) Find the site of the error (the thing highlighted in pink) Racket also displays the error clearly in red. Every time you make a procedure call, use a line break. Change misleading variable names (ex. a variable named artist whose value is actually an album) Before you debug a broken procedure, clean it up!

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents