Yes... In essence the Haskell definition of "Functor" is meaningless until we nail down the definition of "Composition".
Of course, if we are working in Haskell, it comes with an implementation and, thus, a definition for composition. But that is not the case in J. Still, for the examples here, I imagine we could define an operation on some of the structures here which we could think of as a composition operator. Or, we could think of some of J's conjunctions (especially @ @: & and &:) as being compositions. Hooks and forks might also be thought of as compositions. But if we look at this kind of analogy too closely, things start breaking down, for various reasons (and which of those reasons are important will depend on our perspective). (For example: my perspective is that Haskell places too much emphasis on general recursion, as opposed to primitive recursion, but a Haskell expert would probably instead focus on Haskell's pattern matching as opposed to J's lists and syntax.) Another thing that struct me, about the Haskell definition of fmap was how much its definition looks like J's "under" (though, of course, I understand that they are distinct concepts). Consider: class Functor f where fmap :: (a -> b) -> f a -> f b and compare that with g&.(f inv) One of the differences, between Haskell and J, is that J is designed to be interpreted efficiently. So J typically throws away the history involved in a calculation and only retains the result (the exceptions being when the application programmer explicitly retains that history). Haskell, on the other hand, is a compiler, so it can wait until it sees the whole program and decide which elements of a computation's history to retain because they will be re-used later. -- Raul On Tue, Mar 27, 2012 at 3:33 PM, Boyko Bantchev <boyk...@gmail.com> wrote: >> And, since the earlier reference was discussing ocaml implementations, >> I think we can assume that my first post was focusing on the ML >> meaning of functor. > > That reference discusses how the Haskell (not ML) meaning of functor > can be implemented (in OCaml). > > However, it (as well as the posts in this thread) does not formulate > the sole property that formalizes what it means for Haskell Functor's > fmap to be structure-preserving: > > fmap id ≡ id > fmap (f ∘ g) ≡ (fmap f) ∘ (fmap g) > > for any functions f and g (where ∘ is the composition of functions -- > '.' in Haskell, 'o' in ML). This property is a requirement: without > it, an implementation of fmap, even if signature-complying, does not > make for a functor. (And this is more or less how the notion of > functor is defined in category theory.) > > So, a fmap in J would be any adverb that meets the above conditions. > Of course, we still don't have a functor until we also invent a way > to formally couple such a fmap with the respective data structure. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm