/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~FUNCTION~~~~~~
 NOTES: Similar as the above, but it adds every element in the given list,
 		rather than the list itself.
*/
void List::AppendListWithoutCopy( ListPtr X )
{
	unsigned int i;
	for( i = 0; i< X->GetInternalList().size(); i++ )
	{
		PushWithoutCopy( X->GetInternalList()[i] );
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~FUNCTION~~~~~~
 List::AppendList
 NOTES: Adds all the elements of one list onto another.
*/
void List::AppendList( const ListPtr OtherList ){
	unsigned int i;
	const ListType& OtherVector = OtherList->GetInternalList();
	
	for( i = 0; i < OtherVector.size(); i++ ){
		mList.push_back( CreateVariable<Variable>( SS_BASE_ARGS_DEFAULTS, *(OtherVector[i]->CastToVariable()) ) );
	}
}
VariableBasePtr List::PushOp::Operate( VariableBasePtr pX )
{
	ListPtr pXList = pX->CastToList();
	
	const ListType& XList = pXList->GetInternalList();
	size_t i;
	for( i = 0; i < XList.size(); i++ )
	{
		mParentList.Push( XList[i] );
	}
	
	return mParentList.CastToVariableBase();	
}