Functional Programming

2 thoughts
last posted April 21, 2015, 5:46 a.m.
0

Functor

A functor is a container-like data structure that allows one to apply a function to all its contents.

That is, for a list or an option type, the map operation returns a new list or option where the given function was applied to the contents of the object.

Or, looking at it another way, you can compose a "functor" with a function such that any value that "come out" of the data structure are passed through the function of your choice. From this perspective the data structure is used like a (partial) function composed with another function.

1 later thought