Creates a middleware that applies a map function to results.

@param callable $f Map function that accepts an Aws\ResultInterface and
returns an Aws\ResultInterface.

@return callable
168958
public static function mapResult(callable $f)
    {
        return function (callable $handler) use ($f) {
            return function (
                CommandInterface $command,
                RequestInterface $request = null
            ) use ($handler, $f) {
                return $handler($command, $request)->then($f);
            };
        };
    }
1248457
public function transform(callable $fn)
    {
        $this->prepare();

        $new_data = [];
        foreach ($this->_map as $key => $val) {
            $new_data[$key] = $fn($val);
        }

        return $this->prepareResult($new_data, false);
    }
79198
public function map( $callable ) {
		$items = array();
		$val_type = null;

		foreach ( $this->storage as $key => $val ) {
			$v = call_user_func( $callable, $val, $key );

			if ( ! isset( $val_type ) ) {
				$val_type = gettype( $v );
			}

			$items[ $key ] = $v;
		}

		return new static( $this->get_key_type(), $val_type ? : $this->get_value_type(), $items );
	}
754652
def map_wrap(f):
    
    @functools.wraps(f)
    def wrapper(*args, **kwargs):
        return f(*args, **kwargs)
    return wrapper
1025082
public function map(callable $callback): CollectionInterface
    {
        return $this->wrap(function (Iterator $data) use ($callback) {
            foreach ($data as $key => $value) {
                yield $key => $callback($value, $key);
            }
        });
    }
876041
static function instance(\hlin\archetype\Filesystem $fs, array $filemaps) {
		$i = new static;
		$i->fs = $fs;
		$i->filemaps = $filemaps;
		return $i;
	}
919543
function map(fn, m) {
  if(!isFunction(fn)) {
    throw new TypeError('map: Function required for first argument')
  }

  if(isFunction(m)) {
    return compose(fn, m)
  }

  if(isArray(m)) {
    return array.map(fn, m)
  }

  if(m && isFunctor(m)) {
    return (m[fl.map] || m.map).call(m, fn)
  }

  if(isObject(m)) {
    return object.map(fn, m)
  }

  throw new TypeError('map: Object, Function or Functor of the same type required for second argument')
}
263186
public function bind(callable $function) : Monadic
    {
        $concat = compose(
            function (array $list) use ($function) {
                return fold(
                    function ($acc, $item) use ($function) {
                        $acc[] = $function($item)->extract();

                        return $acc;
                    },
                    $list,
                    []
                );
            },
            partialLeft('array_merge', $this->collection)
        );

        return self::of(flatten($concat($this->collection)));
    }
298100
public function map(callable $fn) : self
    {
        $validate = $fn instanceof Closure;

        return new static(array_map($fn, $this->a), $validate);
    }
192716
public function foldFree(callable $f, callable $return): FantasyLand\Monad
    {
        return $f($this->f)->bind(function (MonadFree $next) use ($f, $return) : FantasyLand\Monad {
            return $next->foldFree($f, $return);
        });
    }
203269
public function apply(callable $fn)
    {
        foreach ($this->items as &$item) {
            $out = call_user_func($fn, $item);
            if (isset($out) && ($out instanceof NodeInterface)) {
                $item = $out;
            }
        }

        return $this;
    }
570306
public function filter(callable $function): Dict
    {
        $result = new Dict();

        foreach ($this->data as $key => $value) {
            if (!!$function($key, $value)) {
                $result->offsetSet($key, $value);
            }
        }

        return $result;
    }
975804
@SuppressWarnings("unchecked")
    public static <From, To> List<To> map(List<From> list, MapClosure<From,To> f) {
        List<To> result = new ArrayList<To>(list.size());
        for (From value : list) {
            result.add( f.eval(value) );
        }
        return result;
    }
699407
public static function mapRequest(callable $fn)
    {
        return function (callable $handler) use ($fn) {
            return function ($request, array $options) use ($handler, $fn) {
                return $handler($fn($request), $options);
            };
        };
    }
1238907
public function map(callable $func = null): self
    {
        if (null === $func) {
            return $this;
        }

        return parent::map($func);
    }
1230846
final public static function fromCallable(callable $function)
    {
        // If is array it could be an instance or static method:
        // ['class', 'method'] or [$instance, 'method'];
        if (is_array($function)) {
            return new \ReflectionMethod($function[0], $function[1]);
        }
        // If it is a closure it could be an actual closure or
        // possibly a closure of another function from
        // \ReflectionFunction::getClosure or \ReflectionMethod::getClosure
        elseif ($function instanceof \Closure) {
            $reflection = new \ReflectionFunction($function);

            // If the name is {closure} it as an actual closure
            if ($reflection->getShortName() === '{closure}') {
                return $reflection;
            }
            // Bail out, no (sane) way of determining the actual function
            // represented by the closure
            throw InvalidFunctionException::invalidFunctionMessage(
                    'The function has been wrapped in closure '
                    . '(most likely  via ReflectionFunction::getClosure or \ReflectionMethod::getClosure) '
                    . 'and this is not supported',
                    $reflection);
        }
        // If an object but not a closure it must be an object defining
        // the __invoke magic method.
        elseif (is_object($function)) {
            return new \ReflectionMethod($function, '__invoke');
        }
        // Fallback to function
        else {
            $name = null;
            is_callable($function, false, $name);

            return new \ReflectionFunction($name);
        }
    }
972252
public static function types(callable $f)
    {
        $ref = self::getReflection($f);

        $docs = $ref->getDocComment();
        $proto = $ref->getParameters();

        preg_match_all('/@param\s+(?P<type>.*?)\s+\$(?P<name>.*?)\s+/', $docs, $docs, PREG_SET_ORDER);

        $params = array();
        foreach ($proto as $p) {
            $name = $p->getName();
            $type = null;
            foreach ($docs as $k => $d) {
                if ($d['name'] === $name) {
                    $type = $d['type'];
                    unset($docs[$k]);
                    break;
                }
            }
            if (is_null($type)) {
                throw new MissingTypeAnnotationException("Cannot determine type for $name.");
            }
            if (count(explode('|', $type)) > 1) {
                throw new AmbiguousTypeAnnotationException("Ambiguous type for $name : $type");
            }
            $params[$name] = $type;
        }

        return $params;
    }