A functor assigns an object of a category to each object and a categorical morphism to each arrow . It preserves the rules for composing arrows:For example, the forgetful functor from the category of groups to the Category of sets keeps the underlying sets and maps of elements while forgetting the group operations. A group homomorphism remains a function, and composing the underlying functions gives the underlying map of the composite group homomorphism.
In the context of computer science, a **functor** is a design pattern that originates from category theory in mathematics. It is a type that can be mapped over, which means it implements a mapping function that applies a function to each element within its context. ### In Programming Languages 1.
New to topics? Read the docs here!