I'm a data analyst, not a software developer, and I often find myself writing a function like this (shown in Python syntax here):
def apply_many(arg, *funcs): return [func(arg) for func in funcs]
so I can do things like
from random import random # generate 10 random numbers for demonstration x = [random() for _ in range(10)] def mean(x): return sum(x) / len(x) result = apply_many(x, min, mean, max)
Which returns the minimum, mean, and maximum in
[0.022936866501094166, 0.3962645320243164, 0.7520986774090447]
apply_many function (with a few additional tweaks) routinely saves a lot of typing for me, and I also believe it makes for more readable code.
Is there some kind of accepted name for this thing? Is there a use for it in proper functional programming?