item of
expects a list as its input, but map
puts a single item from words and numbers into that slot.Map
performs the input function over each item in the input list.
The list inside a list shown above makes it clearest to you now as you answer this self-check item what the structure is, but you're right, in an actual program it would be better to use an abstract data type:
Map
performs the input function on each item of the list—not on the whole list. The expression item (1) of (capitals)
(without using map
at all) would report the list {Augusta, Maine}.map (letter (1) of (item (1) of ( ))) over (capitals)
would report the list {A, B, C, D}.map (item (2) of ()) over (capitals)
would report the list {Maine, Idaho, South Carolina, Iowa}.Map
performs the input function on each item of the list—not on the whole list. The expression all but first of (capitals)
(without using map
at all) would report the list of lists {{Boise, Idaho}, {Columbia, South Carolina}, {Des Moines, Iowa}}.
Consider this list of squares:
Which of the following expressions will report a list?
Choose all that apply.
combine
will report a number.join
(1,4) will report 14.