Niko Matsakis (2013-12-07T02:07:22.000Z)
On Fri, Dec 06, 2013 at 01:20:20PM -0800, Allen Wirfs-Brock wrote:
> Does the surprise then lead you to deeper understanding of essential differences?

I don't disagree with you that there are potential differences, but I
do disagree that these differences are *essential*. It seems to me
that the primary argument against supplying the index is that it
*might* be misused. That is true, but on the other side there are
definite advantages:

1. The index is always meaningful: it is the index in the destination
   vector.

2. Often, but not always, the index will also correspond with the
   index in the source vector. In those cases, the user may make use
   of the index to access neighboring elements in the source vector.

3. Even if the source collection is not known to be indexable, the
   index can still be of use. For example, it may be used to index
   into *other arrays* that are not the source collection. Or it could
   be used as a part of a weighting factor, in which case it is not
   used to index at all. Etc etc.

4. Not supplying the same arguments for `from` means that it is harder
   to convert code that uses `map` to code that uses `from`.  To me
   this argues for supplying the source collection as well, although
   as I said it seems to add very little in practice. But it does no
   particular harm.



Niko
domenic at domenicdenicola.com (2013-12-10T01:39:21.708Z)
On Fri, Dec 06, 2013 at 01:20:20PM -0800, Allen Wirfs-Brock wrote:
> Does the surprise then lead you to deeper understanding of essential differences?

I don't disagree with you that there are potential differences, but I
do disagree that these differences are *essential*. It seems to me
that the primary argument against supplying the index is that it
*might* be misused. That is true, but on the other side there are
definite advantages:

1. The index is always meaningful: it is the index in the destination
   vector.

2. Often, but not always, the index will also correspond with the
   index in the source vector. In those cases, the user may make use
   of the index to access neighboring elements in the source vector.

3. Even if the source collection is not known to be indexable, the
   index can still be of use. For example, it may be used to index
   into *other arrays* that are not the source collection. Or it could
   be used as a part of a weighting factor, in which case it is not
   used to index at all. Etc etc.

4. Not supplying the same arguments for `from` means that it is harder
   to convert code that uses `map` to code that uses `from`.  To me
   this argues for supplying the source collection as well, although
   as I said it seems to add very little in practice. But it does no
   particular harm.