cheatsheet/elm.js
function map(f, a)
{
	var newA = {
		ctor: '_Array',
		height: a.height,
		table: new Array(a.table.length)
	};
	if (a.height > 0)
	{
		newA.lengths = a.lengths;
	}
	for (var i = 0; i < a.table.length; i++)
	{
		newA.table[i] =
			a.height === 0
				? f(a.table[i])
				: map(f, a.table[i]);
	}
	return newA;
}
function map(f, a)
{
	var newA = {
		ctor: '_Array',
		height: a.height,
		table: new Array(a.table.length)
	};
	if (a.height > 0)
	{
		newA.lengths = a.lengths;
	}
	for (var i = 0; i < a.table.length; i++)
	{
		newA.table[i] =
			a.height === 0
				? f(a.table[i])
				: map(f, a.table[i]);
	}
	return newA;
}
function map ( f , a ) { var newA = { ctor : '_Array' , height : a . height , table : new Array ( a . table . length ) } ; if ( a . height > 0 ) { newA . lengths = a . lengths ; } for ( var i = 0 ; i < a . table . length ; i ++ ) { newA . table [ i ] = a . height === 0 ? f ( a . table [ i ] ) : map ( f , a . table [ i ] ) ; } return newA ; }
Maps a function over the elements of an array.
Maps a function over the elements of an array .