Apply a single-argument function to the set.
@param fn A function that takes a TimeSeriesMetricDelta and returns a TimeSeriesMetricDelta.
@return The mapped TimeSeriesMetricDelta from this set.
183400
public TimeSeriesMetricDeltaSet map(Function<? super MetricValue, ? extends MetricValue> fn) {
        return values_
                .map(
                        fn,
                        (x) -> x.entrySet().stream().map((entry) -> apply_fn_(entry, fn))
                )
                .mapCombine(TimeSeriesMetricDeltaSet::new, TimeSeriesMetricDeltaSet::new);
    }
288685
public Bindings bind(FunctionMapper fnMapper, VariableMapper varMapper, TypeConverter converter) {
		Method[] methods = null;
		if (!functions.isEmpty()) {
			if (fnMapper == null) {
				throw new ELException(LocalMessages.get("error.function.nomapper"));
			}
			methods = new Method[functions.size()];
			for (int i = 0; i < functions.size(); i++) {
				FunctionNode node = functions.get(i);
				String image = node.getName();
				Method method = null;
				int colon = image.indexOf(':');
				if (colon < 0) {
					method = fnMapper.resolveFunction("", image);
				} else {
					method = fnMapper.resolveFunction(image.substring(0, colon), image.substring(colon + 1));
				}
				if (method == null) {
					throw new ELException(LocalMessages.get("error.function.notfound", image));
				}
				if (node.isVarArgs() && method.isVarArgs()) {
					if (method.getParameterTypes().length > node.getParamCount() + 1) {
						throw new ELException(LocalMessages.get("error.function.params", image));
					}
				} else {
					if (method.getParameterTypes().length != node.getParamCount()) {
						throw new ELException(LocalMessages.get("error.function.params", image));
					}
				}
				methods[node.getIndex()] = method;
			}
		}
		ValueExpression[] expressions = null;
		if (identifiers.size() > 0) {
			expressions = new ValueExpression[identifiers.size()];
			for (int i = 0; i < identifiers.size(); i++) {
				IdentifierNode node = identifiers.get(i);
				ValueExpression expression = null;
				if (varMapper != null) {
					expression = varMapper.resolveVariable(node.getName());
				}
				expressions[node.getIndex()] = expression;
			}
		}
		return new Bindings(methods, expressions, converter);
	}
420656
public static <K, V> void mapfx(Map<K, V> map, MapFunction<K, V> fx) {
        Set<Entry<K, V>> entries = entries(map);
        for (final Entry<K, V> entry : entries) {
            K key = entry.getKey();
            V value = entry.getValue();
            fx.apply(key, value);
        }
    }
1275560
@Override
  public <T> Streamlet<T> map(SerializableFunction<R, ? extends T> mapFn) {
    checkNotNull(mapFn, "mapFn cannot be null");

    MapStreamlet<R, T> retval = new MapStreamlet<>(this, mapFn);
    addChild(retval);
    return retval;
  }
249486
public Transform getTransform(String functionName) {
        Function function = Function.fromString(functionName);

        switch (function) {
            case DIVIDE:
                return new MetricReducerOrMappingTransform(new DivideValueReducerOrMapping());
            case SUM:
                return new MetricReducerOrMappingTransform(new SumValueReducerOrMapping());
            case MULTIPLY:
            case SCALE:
                return new MetricReducerOrMappingTransform(new ScaleValueReducerOrMapping());
            case DIFF:
                return new MetricReducerOrMappingTransform(new DiffValueReducerOrMapping());
            case PERCENTILE:
                return new MetricReducerOrMappingWithConstantTransform(new PercentileValueReducerOrMapping());
            case DEVIATION:
                return new MetricReducerOrMappingWithConstantTransform(new DeviationValueReducerOrMapping());
            case AVERAGE:
                return new MetricReducerTransform(new AverageValueReducer());
            case MIN:
                return new MetricReducerTransform(new MinValueReducer());
            case MAX:
                return new MetricReducerTransform(new MaxValueReducer());
            case PROPAGATE:
                return new PropagateTransform();
            case UNION:
                return new MetricUnionTransform(new UnionValueUnionReducer());
            case GROUP:
                return new GroupTransformWrapUnion();
            case COUNT:
                return new CountTransformWrapUnion();
            case SORT:
                return new SortTransformWrapAboveAndBelow();
            case DOWNSAMPLE:
                return new DownsampleTransform();
            case INTEGRAL:
                return new IntegralTransform();
            case JOIN:
                return new JoinTransform();
            case LIMIT:
                return new LimitTransform();
            case RANGE:
                return new RangeTransformWrap();
            case NORMALIZE:
                return new NormalizeTransformWrap();
            case FILL:
                return new FillTransform();
            case FILL_CALCULATE:
                return new FillCalculateTransform();
            case ALIAS:
                return new AliasTransform();
            case ALIASBYTAG:
                return new AliasByTagTransform();
            case INCLUDE:
                return new IncludeTransform();
            case EXCLUDE:
                return new ExcludeTransformWrap();
            case HW_FORECAST:
                return new HoltWintersForecast(_tsdbService);
            case HW_DEVIATION:
                return new HoltWintersDeviation(_tsdbService);
            case IDENTITY:
                return new IdentityTransform();
            case ZEROIFMISSINGSUM:
                return new ZeroIfMissingSum();
            case ABOVE:
                return new MetricFilterWithInteralReducerTransform(new AboveValueFilter());
            case BELOW:
                return new MetricFilterWithInteralReducerTransform(new BelowValueFilter());
            case HIGHEST:
                return new MetricFilterWithInteralReducerTransform(new HighestValueFilter());
            case LOWEST:
                return new MetricFilterWithInteralReducerTransform(new LowestValueFilter());
            case ABSOLUTE:
                return new MetricMappingTransform(new AbsoluteValueMapping());
            case DERIVATIVE:
                return new MetricMappingTransform(new DerivativeValueMapping());
            case CULL_ABOVE:
                return new MetricMappingTransform(new CullAboveValueMapping());
            case CULL_BELOW:
                return new MetricMappingTransform(new CullBelowValueMapping());
            case CONSECUTIVE:
                return new MetricMappingTransform(new ConsecutiveValueMapping());
            case LOG:
                return new MetricMappingTransform(new LogValueMapping());
            case SHIFT:
                return new MetricMappingTransform(new ShiftValueMapping());
            case MOVING:
                return new MetricMappingTransform(new MovingValueMapping());
            case SUM_V:
                return new MetricZipperTransform(new SumValueZipper());
            case SCALE_V:
                return new MetricZipperTransform(new ScaleValueZipper());
            case DIFF_V:
                return new MetricZipperTransform(new DiffValueZipper());
            case DIVIDE_V:
                return new MetricZipperTransform(new DivideValueZipper());
            case NORMALIZE_V:
                return new MetricZipperTransform(new DivideValueZipper());
            case ANOMALY_STL:
                return new AnomalySTLTransform();
            case GROUPBY:
            	return new GroupByTransform(this);
            case GROUPBYTAG:
                return new GroupByTagTransform(this);
            case ANOMALY_DENSITY:
                return new AnomalyDetectionGaussianDensityTransform();
            case ANOMALY_ZSCORE:
                return new AnomalyDetectionGaussianZScoreTransform();
            case ANOMALY_KMEANS:
                return new AnomalyDetectionKMeansTransform();
            case ANOMALY_RPCA:
                return new AnomalyDetectionRPCATransform();
            case INTERPOLATE:
                return new InterpolateTransform();
            default:
                throw new UnsupportedOperationException(functionName);
        } // end switch
    }
108523
public static <T, R> Function1<T, R> memoizeFunction(final Function<T, R> fn, final Cacheable<R> cache) {
        LazyImmutable<R> nullR = LazyImmutable.def();
        return t -> t==null? nullR.computeIfAbsent(()->fn.apply(null)) : (R)cache.soften()
                         .computeIfAbsent(t, (Function) fn);
    }
969999
def map(self, fn):
        """"""
        return TimeSeries([(x, fn(y)) for x, y in self.points])
934361
public static <R, C, V> Function<Table.Cell<R, C, V>, C> toColumnKeyFunction() {
    return new Function<Table.Cell<R, C, V>, C>() {
      @Override
      public C apply(final Table.Cell<R, C, V> input) {
        return input.getColumnKey();
      }
    };
  }
307920
public synchronized @Nullable <Z> Z map(Function<T, Z> f) {
        if (ref == null) {
            return f.apply(null);
        } else {
            return f.apply(ref.get());
        }
    }
375623
public static Function<Object,Float> f(final String methodName, final Object... optionalParameters) {
        return methodForFloat(methodName, optionalParameters);
    }
647546
public static double getLPNormP(AbstractMaterializeKNNPreprocessor<?> kNN) {
    DistanceFunction<?> distanceFunction = kNN.getDistanceQuery().getDistanceFunction();
    if(LPNormDistanceFunction.class.isInstance(distanceFunction)) {
      return ((LPNormDistanceFunction) distanceFunction).getP();
    }
    return Double.NaN;
  }
480966
function( fn ){
      var _p = this._private;
      var pass = _p.pass[0];

      return this.map( fn ).then(function( include ){
        var ret = [];

        for( var i = 0; i < pass.length; i++ ){
          var datum = pass[i];
          var incDatum = include[i];

          if( incDatum ){
            ret.push( datum );
          }
        }

        return ret;
      });
    }
369161
private static ImmutableSet<String> getFunctionParameterSet(Node fnNode) {
    ImmutableSet.Builder<String> builder = ImmutableSet.builder();
    for (Node n : NodeUtil.getFunctionParameters(fnNode).children()) {
      if (n.isRest()){
        builder.add(REST_MARKER);
      } else if (n.isDefaultValue() || n.isObjectPattern() || n.isArrayPattern()) {
        throw new IllegalStateException("Not supported: " + n);
      } else {
        builder.add(n.getString());
      }
    }
    return builder.build();
  }
905396
public static <T> TypedColumn<T, Double> avg(MapFunction<T, Double> f) {
    return new TypedAverage<T>(f).toColumnJava();
  }
617916
def vectorize(fn):
    

    @functools.wraps(fn)
    def vectorized_function(values, *vargs, **kwargs):
        return [fn(value, *vargs, **kwargs) for value in values]

    return vectorized_function
1359572
public static <T, F> Function<F, T> bind(final Function<F, T> function) {
        return new Function<F, T>() {
            @Override
            public T apply(F arg) {
                return function.apply(arg);
            }
        };
    }
927241
public <B> MonoT<W,B> flatMapT(final Function<? super T, MonoT<W,B>> f) {
        MonoT<W, B> r = of(run.map(future -> Mono.from(future.flatMap(a -> {
            Mono<B> m = f.apply(a).run.stream()
                    .toList()
                    .get(0);
            return m;
        }))));
        return r;
    }