Sep-18-2020, 11:46 AM
I'm reading the thread on a phone and also don't have much time to go through all of your posts in great detail right now, but some things stood out:
The first argument to
There is no "iterating over a function". As I mentioned,
As an exercise, could you write a
The first argument to
map
is the function, not the iterable.There is no "iterating over a function". As I mentioned,
map
iterates over the iterable calling the function on each of the items. That much should be obvious from the examples you showed of squaring and doubling each item in the tuples given.As an exercise, could you write a
for
loop for each of those caees You'll see that those loops look very similar; the only thing that varies is the function you're calling on the items. Once you realise that, you could write your own version of map
by putting that loop inside a function whose arguments are the iterable and the function to transform each item.