
Combine
Block (Teacher's Choice)combine
not combine
.
The block takes an operation (with two blank input slots) and a a list as input and reports a single result: the combination for all of the elements of the list when using the given operation. For example:
You choose the operation (with two input slots), and combine
performs that operation between all the items in the input list and reports the result.
combine
does in this script: map
, there's still only one inputmax
? What seems to be going in the blanks for combine
?
Ways to Think About It. When you see this:
Combine
is used with functions that take two inputs like:
or the
max
function that you defined above.
These operations are associative, which means that the result is the same no matter how the items are grouped. For example, (3 + 4) + 5 = 3 + (4 + 5) and join words
("the cat")("sat") = join words
("the")("cat sat").
combine
? Try it.combine
because the grouping of the items matters in these cases. For example, (3 – 4) – 5 ≠ 3 – (4 – 5). sum
that takes a list of numbers and reports their sum.numbers
: \text{average} = \frac{\text{sum of numbers}}{\text{total number of numbers}}
map
? What seems to be going in the blanks for combine
? factorial
that models this using combine
.
Use this list of squares:
Which of these expressions will report a list?
Choose all that apply.
combine
will report a number.
join
(1,4) will report 14.
Use the same list of squares:
The expressions in this problem are the same as you saw in question 1.
Which of these statements are true?
Choose all that apply.
combine
will report a number, whereas map
will report a list.