Remix.run Logo
exasperaited 8 days ago

This is "english-sentence-order-consistent", as it goes.

Array filter is "filter this array with this function".

Array map is "map this function over this array".

But I agree any replacement function should be consistent with Haskell.

eurleif 8 days ago | parent | next [-]

One can construct English sentences in the opposite order. There is no singular "English sentence order".

"Filter for this function in this array"

"Map over this array with this function"

goykasi 7 days ago | parent | next [-]

But thats not correct. array_map is variadic. So it should actually be "Map over these arrays with this function."

When you use the correct verbiage, the parameter order makes sense.

exasperaited 8 days ago | parent | prev [-]

Right, but these are both more unwieldy.

One filters something with something else, in the real world. Filter water with a mesh etc.

And (in maths, at least) one maps something onto something else. (And less commonly one maps an area onto paper etc.)

Just because you can make your two sentences does not make them natural word order.

quietbritishjim 7 days ago | parent | next [-]

> And (in maths, at least) one maps something onto something else.

Yes, but that's the opposite of what you said earlier. You might map x onto 2*x, for example. Or, if you're talking about a collection, you might map the integers 0..10 on to double their value. Data first, then the way you're manipulating it. I'm a mathematician and this is what makes sense to me.

I would only say "map this function..." if the function itself is being manipulated somehow (mapped onto some other value).

hnlmorg 8 days ago | parent | prev [-]

When you consider that PHP is used by hundreds of thousands of non-native English speakers, I don’t really think you can make a legitimate claim that “English sentence order” trumps “consistent argument ordering”.

There’s enough viral videos online of how even neighbouring European counties order common sentences differently. Even little things like reading the time (half past the previous hour vs half to the next hour) and counting is written differently in different languages.

So modelling the order of parameters based on English vernacular doesn’t make a whole lot of sense for programming languages used by programmers of all nationalities.

7 days ago | parent | next [-]
[deleted]
exasperaited 7 days ago | parent | prev [-]

> When you consider that PHP is used by hundreds of thousands of non-native English speakers, I don’t really think you can make a legitimate claim that “English sentence order” trumps “consistent argument ordering”.

Well that’s good, because I didn’t.

8 days ago | parent | prev [-]
[deleted]