On Sun, April 1, 2012 5:41 pm, Boyko Bantchev wrote: > Functors in J? > ************** > > The observed correspondence between category theory and Haskell can > be summarized in the following table. > > category theory Haskell > --------------------------------------------------------------------- > category the universal category of types; > specific categories (families of datatypes) > > category constructor type constructor > > object type > > arrow function > > composition of arrows composition of functions > > definition of functor Functor interface and axioms > as concept > > functor axioms-complying implementation of Functor > (associated with a specific tycon) > > If we can build a similar table with J in the right column, we can > say that we have an idea what might be a J's version of functors in > general.
We can, indeed. We do not have strong typing. We do have several numeric types using different forms of arithmetic: Boolean, integer, float, rational, extended precision, complex, and we have methods for mapping among some of them explicitly. However, we do not map functions on them explicitly. Our arithmetic primitives are overloaded with various kinds of special case code, which are inherited by defined verbs, adverbs, and conjunctions. The case where we do have an explicit mapping is boxed lists, where we map functions to operate on their contents using the under or dual conjunction in the phrase &.> . Iverson added duality to J specifically to support functor-like actions based on commutative diagrams of the kind Boyko cited as axioms in Category Theory. Thus u&.>x is <u>x for x a single boxed array, and we extend that to arrays of boxed items in the manner of scalar extension generally. We can view all adverbs and conjunctions as functors, though of a much more general type than those in Haskell or Category Theory. For example, / maps scalar verbs to rank 1 verbs, corresponding to a mapping between tables of scalars and lists of lists, with a generalization to higher dimensions. Except that, here again, we do not have to map arrays in this fashion in order to use them in these various ways. -- Edward Mokurai (默雷/निशब्दगर्ज/نشبدگرج) Cherlin Silent Thunder is my name, and Children are my nation. The Cosmos is my dwelling place, the Truth my destination. http://wiki.sugarlabs.org/go/Replacing_Textbooks ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm