PSYC 315 Lecture 6: Mapping and Values

15 views3 pages

Document Summary

Lambda expressions: unnamed functions (lambda parameter-list body, example 1, function (lambda (x) (* x x x), call ((lambda (x) (* x x x)) 5) T 3 is odd: example 2 (mapcar #"= (1 2 3) (3 2 1)) Nil 1 & 3 are not equal. T 2 & 2 are equal. Nil 3 & 1 are not equal. Psyc 315: computational psychology: example 3 (mapcar #"+ (1 2 3 4) 4 from adding first items (1, 1, 1, 1) 17 from adding second items (2, 3, 4, 8) 44 from adding third items (3, 5, 9, 27) Only list of 3 items because not all the lists have 4 items: mapping a lambda expression (mapcar (lambda (x y) (+ x y)) (3 4) (5 6 7): add the x"s and add the y"s, 3 + 5 = 8 (8 10, 4 + 6 = 10.

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