Map
is a function which takes another function and applies it to each item in a list, returning the new list.
1 2 3 |
|
Using only
head
and
tail
as defined by the
List ADT
, implement
map
.
Use your implementation of
map
to apply the function
1 2 |
|
to the list .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Using the Python implementation from the Lists wiki .