Map multiple functions over a single data item

Posted by Linus Norton on Programmers See other posts from Programmers or by Linus Norton
Published on 2014-08-24T13:12:45Z Indexed on 2014/08/24 16:28 UTC
Read the original article Hit count: 176

I'm in the process of learning Scala and I came across a scenario today where I need to map multiple functions over a single piece of data and wondered if there was a formal name for this. It sort of feels like the inverse of map.

I'm not sure this is the correct way of expressing it, but this is what I did:

dmap(x: Object, fns: List[Function]) = fns.map(_(x))

Is there a built in way to do something similar? Is there a formal name for this function?

© Programmers or respective owner

Related posts about functional-programming

Related posts about language-agnostic