J in fact involves two types of functors: arrays as discussed, and
functions.
"Mapping" over functions is a bit harder to visualize, but it's helpful to
think of a function as a value that depends on its input. In this case,
when we apply a fork to two functions in order to refer to their values (or
to one, using [:), we are actually mapping over the two.

J also provides a bit more structure than a simple functor. In particular,
it implements Haskell's Applicative typeclass, which also specifies
(indirectly) that a function can be mapped over multiple arguments at the
same time. Additionally, there's the property that we can map over a
functor and a non-functor, i.e. 1 + 4 6 5 or 3+*: . This doesn't require
more structure than the Applicative provides, but adds a considerable
amount of power.

The paper I posted here a while ago provides further description of this
and extensions to a number of data structures, such as boxes and sets.
https://docs.google.com/open?id=0B9JcSIlTRG6FZjA1NjE4ZTgtYzhiYy00YzA0LTkxODUtZDUwODg5OGEwYmE5

Marshall

On Mon, Mar 26, 2012 at 1:51 PM, Tracy Harms <kalei...@gmail.com> wrote:

> When I read about functor, in the sense used in that blogpost, I think that
> at least one such functor is built in to J so that it is somewhere between
> stilted and impossible to create examples that *don't* involve functor.
>
> It seems that way to me because mapping is implied by the underlying
> relationship between nouns and verbs, a relationship that may best be
> called rank. The description of functor, with its scalar assumptions about
> values, makes things like shape a context of values that can be preserved.
> Thus, my sense is that functors permeate J to such a degree that it would
> make little sense to try to "implement" one to serve as an example. The
> most basic computations already involve it.
>
> If my interpretation can be criticized, I'd love to hear strong criticism.
> This is the sort of discussion that often comes up with people who come at
> programming from an ML perspective, so any mistakes I can avoid will help
> me as such conversations go on.
>
> --
> Tracy
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to