dbo:abstract
|
- In functional programming, a functor is a design pattern inspired by the definition from category theory, that allows for a generic type to apply a function inside without changing the structure of the generic type. This idea is encoded in Haskell using type class class Functor f where fmap :: (a -> b) -> f a -> f b with conditions called functor laws, fmap id = idfmap (g . h) = (fmap g) . (fmap h) In Scala are used trait Functor[F[_]] { def map[A,B](a: F[A])(f: A => B): F[B]} Simple examples of this are Option and collection types. Functors are very useful in modeling to apply a function to computations that did not yet finish. Functors form a base for more complex abstractions like Applicative, Monad, Comonad. In C++, the name functor is commonly used to refer to a function object, even though the ISO/IEC 14882 standard specification itself exclusively uses the latter term. (en)
- 在函数式编程中,函子(functor)是受到范畴论函子启发的一种设计模式,它允许泛化类型在内部应用一个函数而不改变泛化类型的结构。函子形成了更复杂的抽象如应用式、单子、Comonad的基础。 (zh)
|
dbo:wikiPageExternalLink
| |
dbo:wikiPageID
| |
dbo:wikiPageLength
|
- 2021 (xsd:nonNegativeInteger)
|
dbo:wikiPageRevisionID
| |
dbo:wikiPageWikiLink
| |
dbp:wikiPageUsesTemplate
| |
dcterms:subject
| |
rdfs:comment
|
- 在函数式编程中,函子(functor)是受到范畴论函子启发的一种设计模式,它允许泛化类型在内部应用一个函数而不改变泛化类型的结构。函子形成了更复杂的抽象如应用式、单子、Comonad的基础。 (zh)
- In functional programming, a functor is a design pattern inspired by the definition from category theory, that allows for a generic type to apply a function inside without changing the structure of the generic type. This idea is encoded in Haskell using type class class Functor f where fmap :: (a -> b) -> f a -> f b with conditions called functor laws, fmap id = idfmap (g . h) = (fmap g) . (fmap h) In Scala are used trait Functor[F[_]] { def map[A,B](a: F[A])(f: A => B): F[B]} Functors form a base for more complex abstractions like Applicative, Monad, Comonad. (en)
|
rdfs:label
|
- Functor (functional programming) (en)
- 函子 (函数式编程) (zh)
|
owl:sameAs
| |
prov:wasDerivedFrom
| |
foaf:isPrimaryTopicOf
| |
is dbo:wikiPageDisambiguates
of | |
is dbo:wikiPageWikiLink
of | |
is foaf:primaryTopic
of | |