3 ms·
Yeah, map(<big function>, array) creates a dependency that exists from when you read "map" to when you read the name of the array, potentially spanning a very l
by canjobear 11y ago
Yeah, map(<big function>, array) creates a dependency that exists from when you read "map" to when you read the name of the array, potentially spanning a very long function. But if you have map(array) do <big function>, then you only have a dependency from "map" to the beginning of the function.
In general, if you have a function call f(a, ..., y, z), when you parse that (mentally, or in a shift-reduce parser) you have to keep the function name f in memory all the way to z. So you want to make a, ..., y as short as possible.
Similarly, dependency length minimization predicts that in English people will want to order expressions from short to long after a verb or preposition. There is a lot of evidence for this preference; it's been documented since the 1930s.
If there were a programming language where the function name came after the arguments, like (a, b)f, then the best order would be long-to-short.
Similarly, the DLM prediction for verb-final languages like Japanese is that people will prefer long-to-short orders. It appears that this preference does exist, but it is much weaker than the short-to-long preference among speakers of English-like languages.