HH\ImmSet::map

Returns an ImmSet containing the values after an operation has been applied to each value in the current ImmSet.

Description

public function map(
  (function(Tv):Tu) $callback,
): ImmSet<Tu>

Returns an ImmSet containing the values after an operation has been applied to each value in the current ImmSet.

Every value in the current ImmSet is affected by a call to map(), unlike filter() where only values that meet a certain criteria are affected.

Parameters

  • (function(Tv):Tu) $callback - The callback containing the operation to apply to the current ImmSet values.

Return Values

  • ImmSet<Tu> - a ImmSet containing the values after a user-specified operation is applied.

Examples

See Set::map for usage examples.