A design pattern representing a container that can be mapped over, implementing a map function that applies a transformation to the contained values while preserving the container structure. Functors must satisfy identity and composition laws.
Borrowed from category theory, where it was coined by Samuel Eilenberg and Saunders Mac Lane in the 1940s, from Latin 'functio' meaning performance. The term entered programming through functional programming languages that adopted mathematical abstractions.
A functor is like a magical box that you can apply transformations to without opening it - you hand it a function that turns apples into oranges, and somehow all the apples inside become oranges while staying in the same box! This abstraction is everywhere: arrays, promises, and optional values are all functors.
Complete word intelligence in one call. Free tier — 50 lookups/day.