sheet (1249B)
1 12.1) 2 head | 1 3 tail | [2, 3, 4] 4 5 12.2) 6 [2, 4, 6, 8] 7 8 12.3) 9 I fisrt put the list into the function map, because the list was not empty, I used the second definition. 10 I applied f to the head of the list, then I applied map onto the tail of the list. 11 Because the tail was not empty I repeated this again. 12 I repeated this until I got an empty list 13 Then the most recent call to map returns, and gets conncatinated to the second to last function calling f on x. 14 This repeates as the call stack collapses, leaving behind the list, with all values having f applied to x 15 16 8.1) 17 WHO KNOWS 18 19 8.2) 20 36 21 22 8.3) to apply a function onto a list in a specific order. 23 24 6.1) 25 10 26 27 6.2) 28 map square a | [1, 9, 25] 29 filter (<10) b | [1, 5] 30 fold (+) 0 c | 18 31 32 6.3) 33 A function that takes another function as an argument or a returns function as a result 34 35 15.1) 36 3 37 38 15.2) 39 fw [4, 3] | 12 40 fx sales | [20, 50, 32] 41 fz sales | 102 42 43 15.3) 44 This is the total of sales, the amount sold in a day perhaps 45 46 7.1) 47 NO CLUE 48 49 7.2) 50 4 51 52 7.3) 53 plus4 = add 4 54 result = plus4 6 55 ' 56 11.1) 57 head | "Blackpool" 58 tail | ["Paris", "New Brighton", "Toronto"] 59 60 11.2) 61 A function that takes another function as an argument or a returns function as a result 62 63 11.3) 64 (((1 * 2) * 3) * 2) 65 ((2 * 3) * 2) 66 (6 * 2) 67 (12) 68 12