// These are Array Extensions

Array.prototype.where = function(f)
{
	var result = [];
	
	for(var i=0; i<this.length; i++)
	{
		if(f(this[i]))
			result.push(this[i]);
	}
	
	return result;
};

Array.prototype.exists = function(f)
{
	for(var i=0; i<this.length; i++)
	{
		if(f(this[i]))
			return true;
	}
	
	return false;
};

Array.prototype.first = function(f)
{
	for(var i=0; i<this.length; i++)
	{
		if(f(this[i]))
			return this[i];
	}
	
	return null;
};
	
