src/eMacros/Runtime/Collection/ArrayMap.php
public function apply(Scope $scope, GenericList $arguments) {
		$nargs = count($arguments);
		if ($nargs == 0) throw new \BadFunctionCallException("ArrayMap: No callback specified.");
		elseif ($nargs == 1) throw new \BadFunctionCallException("ArrayMap: No target specified.");
		$op = $arguments[0]->evaluate($scope);
		
		if (is_callable($op)) {
			$args = [];
			$it = $arguments->getIterator();
			$it->rewind();
			
			for ($it->next(); $it->valid(); $it->next()) {
				 $el = $it->current()->evaluate($scope);
				 
				 if ($el instanceof \IteratorAggregate) {
				 	$eit = $el->getIterator();
				 	$eit->rewind();
				 	$el = [];
				 	for (;$eit->valid(); $eit->next())
				 		$el[] = $eit->current();
				 }
				 
				 $args[] = $el;
			}
			
			array_unshift($args, $op);
			return call_user_func_array('array_map', $args);
		}
		
		throw new \InvalidArgumentException("ArrayMap: Expected callable as first argument.");
	}
public function apply(Scope $scope, GenericList $arguments) {
		$nargs = count($arguments);
		if ($nargs == 0) throw new \BadFunctionCallException("ArrayMap: No callback specified.");
		elseif ($nargs == 1) throw new \BadFunctionCallException("ArrayMap: No target specified.");
		$op = $arguments[0]->evaluate($scope);
		
		if (is_callable($op)) {
			$args = [];
			$it = $arguments->getIterator();
			$it->rewind();
			
			for ($it->next(); $it->valid(); $it->next()) {
				 $el = $it->current()->evaluate($scope);
				 
				 if ($el instanceof \IteratorAggregate) {
				 	$eit = $el->getIterator();
				 	$eit->rewind();
				 	$el = [];
				 	for (;$eit->valid(); $eit->next())
				 		$el[] = $eit->current();
				 }
				 
				 $args[] = $el;
			}
			
			array_unshift($args, $op);
			return call_user_func_array('array_map', $args);
		}
		
		throw new \InvalidArgumentException("ArrayMap: Expected callable as first argument.");
	}
Applies a callback to a given array
Usage: (Array::map "strtoupper" (array "a" "b" "c"))
Returns: array
(non-PHPdoc)
@see \eMacros\Applicable::apply()