Array generation

Bill Frantz frantz at
Mon Jul 11 17:44:20 PDT 2011

On 7/11/11 at 15:09, liorean at (liorean) wrote:

>On 10 July 2011 22:23, David Herman <dherman at> wrote:
>>Another common and useful fusion of two traversals that's in many Schemes is map-filter or
>>   a.filterMap(f) ~~~ [res for [i,x] of items(a) let (res = f(x, i)) if (res !== void 0)]
>>I rather arbitrarily chose to accept both null and undefined here as way to say "no element" -- a
>reasonable alternative would be to accept *only* undefined as "no element".
>The way I think of it is that in analogy to NaN being the Numbers that
>represent no number, null is the Object that represents no object, in
>other words a reasonable value to store to tell just that. The
>undefined value is by analogy the value that represents no value, so
>is the only value that should be a "no element".

The way I think of it is that NaN can be produced if an 
algorithm "blows up" numerically. If that happens, and the 
result gets stored in the array, I don't want to confuse those 
values with the "placeholder for purposely omitted value" value.

Cheers - Bill

Bill Frantz        |"Web security is like medicine - trying to 
do good for
408-356-8506       |an evolved body of kludges" - Mark Miller |

More information about the es-discuss mailing list