CSC104H1 Lecture Notes - Lecture 7: South African Heritage Resources Agency

28 views6 pages

Document Summary

;(map f (list a b c ))---(list (f a) (f b) (f c)) ;mapping always produces a list, with as many elements as the original list. The function must be able to accept a single argument. ;spr accpets a single number, its contract is: sqr: number--number (check-expect (spr 5) 25) spr: this function is not defined. > (check-expect (sqr 2) 4) (check-expect (sqr 10) 100) (check-expect (sqr 10) (* 10 10)) > ;now we map it onto a list of numbers, and that will produce a list of numbers (step parallel) steps. > (map sqr (list 5 2 10)) (list 25 4 100) > (step parallel (map sqr (list 5 2 10))) steps (map sqr (list 5 2 10)) (list (sqr 5) (sqr 2) (sqr 10)) (list 25 4 100) > ;the addition function accepts single numbers, and produces a number + (check-expect (+ 5) 5) (check-expect (+ 2) 2) (check-expect (+ 10) 10)

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
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions