On Tue, Dec 11, 2018 at 2:16 AM Chris Barker <chris.barker@noaa.gov> wrote:
On Mon, Dec 10, 2018 at 5:23 AM E. Madison Bray <erik.m.bray@gmail.com> wrote:
Indeed; I believe it is very useful to have a map-like object that is effectively an augmented list/sequence.
but what IS a "map-like object" -- I'm trying to imagine what that actually means.
"map" takes a function and maps it onto a interable, returning a new iterable. So a map object is an iterable -- what's under the hood being used to create it is (and should remain) opaque.
I don't understand why this is confusing. Greg gave an example of what this *might* mean up thread. It's not the only possible approach but it is one that makes a lot of sense to me. The way you're defining "map" is arbitrary and post-hoc. It's a definition that makes sense for "map" that's restricted to iterating over arbitrary iterators. It's how it happens to be defined in Python 3 for various reasons that you took time to explain at great length, which I regret to inform you was time wasted explaining things I already know. For something like a fixed sequence a "map" could just as easily be defined as a pair (<function>, <sequence>) that applies <function>, which I'm claiming is a pure function, to every element returned by the <sequence>. This transformation can be applied lazily on a per-element basis whether I'm iterating over it, or performing random access (since <sequence> is known for all N). Python has no formal notion of a pure function, but I'm an adult and can accept responsibility if I try to use this "map-like" object in a way that is not logically consistent. The stuff about Sage is beside the point. I'm not even talking about that anymore.