PSYC 315 Lecture Notes - Lecture 8: Entire Function
Document Summary
Computes expected value of a decision by summing the products of outcome probabilities and values. (do ((p ps (cdr p)) (v vs (cdr v)) (sum 0 (+ sum (* (car p) (car v))))) ((null p) sum)) In the debugger ---------- : click on cancel, correct function (defun expected-value (ps vs) Computes expected value of a decision by summing the products of outcome probabilities and values. (do ((p ps (cdr p)) (v vs (cdr v)) (sum 0 (* (car p) (car v)))) ((null p) sum))) Psyc 315: computational psychology (expected-value-buggy (. 7 . 5 . 2) (. 6 . 3 . 7)) -> 0. 14. 2: buggy print sum (defun expected-value-buggy-print (ps vs) 0. 14: buggy2 (defun expected-value-buggy2 (ps vs) Computes expected value of a decision by summing the products of outcome probabilities and values. (do ((p ps (cdr p)) (v vs (cdr p)) (sum 0 (* (car p) (car v))))