Image for Functor

Functor

A functor is a concept from mathematics and programming that describes a consistent way to apply a function to, or transform, objects within a structure (like lists or other collections) without changing the structure itself. Think of it as a "map" operation that takes a container—say, a list of numbers—and applies a function to each item, resulting in a new list with the transformed elements. The key idea is that the overall structure remains intact, while its contents are systematically modified. This approach helps organize transformations in a predictable and composable manner.