If possible, replace functions of the form ()=>{ return x; } with ()=>x
346001
private void maybeSimplifyArrowFunctionBody(Node arrowFunction, Node body) {
    checkArgument(arrowFunction.isArrowFunction());
    if (!body.isBlock() || !body.hasOneChild() || !body.getFirstChild().isReturn()) {
      return;
    }
    Node returnValue = body.getFirstChild().removeFirstChild();
    Node replacement = returnValue != null ? returnValue : IR.name("undefined");
    arrowFunction.replaceChild(body, replacement);
    compiler.reportChangeToEnclosingScope(replacement);
  }
917677
function replacerFactory(opt) {
    function replacer(key, value) {

        if (typeof value === 'function') {
            if (opt.functionDetail) {
                return value.toString()
            } else {
                return `function ${value.name}() {...}`
            }
        }
        return value
    }

    return replacer
}
183047
public <X extends Exception> void replaceAll(Try.BiFunction<? super K, ? super V, ? extends V, X> function) throws X {
        List<K> keyToRemove = null;
        V newVal = null;

        for (Map.Entry<K, V> entry : valueMap.entrySet()) {
            newVal = function.apply(entry.getKey(), entry.getValue());

            if (N.isNullOrEmpty(newVal)) {
                if (keyToRemove == null) {
                    keyToRemove = new ArrayList<>();
                }

                keyToRemove.add(entry.getKey());
            } else {
                try {
                    entry.setValue(newVal);
                } catch (IllegalStateException ise) {
                    throw new ConcurrentModificationException(ise);
                }
            }
        }

        if (N.notNullOrEmpty(keyToRemove)) {
            for (K key : keyToRemove) {
                valueMap.remove(key);
            }
        }
    }
856907
def compose_functions(*func_list):
    
    def apply_composition(f, g):
        def compose(x):
            return f(g(x))
        return compose
    composed_func = functools.reduce(apply_composition, func_list)
    return composed_func
611124
function compose() {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return function (arg0) {
      return (0, _array.reduceRight)(function (value, fn) {
        return fn(value);
      }, arg0, args);
    };
  }
95034
function () {
    var pattern = /\{(\d+)\}/g;
    //safer way to convert a pseudo array to an object array
    var args = Array.prototype.slice.call(arguments);
    var s = args.shift();
    return s.replace(pattern, function(c, d) {
      var replacement = args[d] ;
      if (lib.isNull(replacement)) {
        replacement = "";
      }
      return replacement;
    });
  }
215207
def compose(*funcs):
    """"""
    return lambda x: reduce(lambda v, f: f(v), reversed(funcs), x)
44410
def CallUDFUNS(f, x):
    
    value = c_double()
    f(x, byref(value))
    return value.value
1129352
def transform(func, data):
    
    out = []
    for r in data:
        out.append(func(r))
    return out
881752
function Function_(types) {
    var tuples = Z.reduce (function(tuples, t) {
      tuples.push (['$' + show (tuples.length + 1), K ([]), t]);
      return tuples;
    }, [], types);

    function format(outer, inner) {
      return when (tuples.length !== 2)
                  (parenthesize (outer))
                  (joinWith (outer (', '),
                             Z.map (function(tuple) {
                               return when (tuple[2].type === FUNCTION)
                                           (parenthesize (outer))
                                           (inner (tuple[0])
                                                  (show (tuple[2])));
                             }, init (tuples)))) +
             outer (' -> ') +
             inner ((last (tuples))[0])
                   (show ((last (tuples))[2]));
    }

    return _Type (FUNCTION,
                  '',
                  '',
                  types.length,
                  format,
                  [AnyFunction],
                  K (K (true)),
                  tuples);
  }
1246252
def _replace_by(module_function, warn=False):
    """"""
    def decorate(func, module_function=module_function, warn=warn):
        sys.path.append(os.path.dirname(__file__))
        try:
            module, function = module_function.split('.')
            func, oldfunc = getattr(__import__(module), function), func
            globals()['__old_' + func.__name__] = oldfunc
        except Exception:
            if warn:
                warnings.warn("failed to import %s" % module_function)
        sys.path.pop()
        return func

    return decorate
1018679
def wrap(func, with_func):
  
  """
  func.__name__ = with_func.__name__
  func.__doc__ = with_func.__doc__
  func.__dict__.update(with_func.__dict__)

  return func
786904
function (regex, fn) {
        var replacements = 0; // maintain a count of tokens replaced

        // to ensure we do not perform needless operations in the replacement, we use multiple replacement functions
        // after validating the parameters
        this.value = (this.value.replace(regex, _.isFunction(fn) ? function () {
            replacements += 1;
            return fn.apply(this, arguments);
        } : function () { // this case is returned when replacer is not a function (ensures we do not need to check it)
            replacements += 1;
            return fn;
        }));

        this.replacements = replacements; // store the last replacements
        replacements && (this.substitutions += 1); // if any replacement is done, count that some substitution was made
        return this;
    }
448073
function(fn) {
		return function() {
			var realArgs = [];
			var fnArgs = arguments;
			each(fnArgs, function(val, i) {
				if (i <= fnArgs.length) {
					while (val && val.isComputed) {
						val = val();
					}
					realArgs.push(val);
				}
			});
			return fn.apply(this, realArgs);
		};
	}
1355754
function curry(f) {
        var args = slice(arguments, 1);
        return function() { return f.apply(this, args.concat(slice(arguments))); };
}
1037907
function replaceValuesWithVariableNames (variables, prefix) {
  const map = {}

  Object.keys(variables || {}).forEach((variableName) => {
    map[variableName] = `var(${formatVariableName(variableName, prefix)})`
  })

  return map
}
23898
def _replace(variables, match):
    
    expression = match.group(1)

    # Look-up chars and functions for the specified operator
    (prefix_char, separator_char, split_fn, escape_fn,
     format_fn) = operator_map.get(expression[0], defaults)

    replacements = []
    for key, modify_fn, explode in split_fn(expression):
        if key in variables:
            variable = modify_fn(variables[key])
            replacement = format_fn(
                explode, separator_char, escape_fn, key, variable)
            replacements.append(replacement)
    if not replacements:
        return ''
    return prefix_char + separator_char.join(replacements)