[In APL,] a surprising result comes from three applications of the principle of least surprise:
1) It should be possible to have an array with no dimensions, and a zero-dimensional array should be the same thing as a scalar.
2) The size of an array should be a vector with one element for each dimension of the array.
3) When you do arithmetic on a scalar and a vector, the result has the same size as the vector.Choosing the least surprising behavior in these three contexts causes the surprising behavior that the average of a scalar sum(v)/size(v) is an empty vector.
Wednesday, October 17, 2007
Principle of Least Surprise
Andrew Koenig has a post on surprises in designs:
Posted by Blinding Insight at 1:21 PM