Presently I am only somewhat familiar with one computer programming language and I have to admit that when I first encountered the word functor (probably here http://www.jsoftware.com/pipermail/general/2002-September/011220.html), I thought it was a little more than meaningless jargon. So, it is with some hesitation that I am sharing some thoughts (bear with me and be gentle).
I am only considering functions in the form of verbs operating on nested nouns and function mapping over the leaves, l=. L:0 NB. Adverb Symbolic verbs and nouns typically help me visualize how adverbs operate, u=. ('('"_ , 'u '"_ , ] , ')'"_) :('('"_ , [ , ' u '"_ , ] , ')'"_) v=. ('('"_ , 'v '"_ , ] , ')'"_) :('('"_ , [ , ' v '"_ , ] , ')'"_) vv=. ('('"_ , 'vv '"_ , ] , ')'"_) :('('"_ , [ , ' vv '"_ , ] , ')'"_) ]T=. 'T0' ; (<'T1';'T2') ; (<(<'T3') , <(2 3$ ;:'T00 T01 T02 T10 T11 T12')) ┌──┬─────────┬──────────────────┐ │T0│┌───────┐│┌──┬─────────────┐│ │ ││┌──┬──┐│││T3│┌───┬───┬───┐││ │ │││T1│T2││││ ││T00│T01│T02│││ │ ││└──┴──┘│││ │├───┼───┼───┤││ │ │└───────┘││ ││T10│T11│T12│││ │ │ ││ │└───┴───┴───┘││ │ │ │└──┴─────────────┘│ └──┴─────────┴──────────────────┘ ]S=. 'S0' ; (<'S1';'S2') ; (<(<'S3') , <(2 3$ ;:'S00 S01 S02 S10 S11 S12')) ┌──┬─────────┬──────────────────┐ │S0│┌───────┐│┌──┬─────────────┐│ │ ││┌──┬──┐│││S3│┌───┬───┬───┐││ │ │││S1│S2││││ ││S00│S01│S02│││ │ ││└──┴──┘│││ │├───┼───┼───┤││ │ │└───────┘││ ││S10│S11│S12│││ │ │ ││ │└───┴───┴───┘││ │ │ │└──┴─────────────┘│ └──┴─────────┴──────────────────┘ In my mind I have always thought that (@:), using the convention of enclosing between parenthesis code embedded in lines to avoid misinterpretations, is the closest to mathematical function composition because it operates on whole arguments. The functor properties are, if I am not misunderstanding, illustrated by ]l T ┌──┬─────────┬──────────────────┐ │T0│┌───────┐│┌──┬─────────────┐│ │ ││┌──┬──┐│││T3│┌───┬───┬───┐││ │ │││T1│T2││││ ││T00│T01│T02│││ │ ││└──┴──┘│││ │├───┼───┼───┤││ │ │└───────┘││ ││T10│T11│T12│││ │ │ ││ │└───┴───┴───┘││ │ │ │└──┴─────────────┘│ └──┴─────────┴──────────────────┘ ]T ┌──┬─────────┬──────────────────┐ │T0│┌───────┐│┌──┬─────────────┐│ │ ││┌──┬──┐│││T3│┌───┬───┬───┐││ │ │││T1│T2││││ ││T00│T01│T02│││ │ ││└──┴──┘│││ │├───┼───┼───┤││ │ │└───────┘││ ││T10│T11│T12│││ │ │ ││ │└───┴───┴───┘││ │ │ │└──┴─────────────┘│ └──┴─────────┴──────────────────┘ (]l -: ]) T 1 and (u l @: (v l)) T ┌──────────┬─────────────────────────┬──────────────────────────────────────────────────┐ │(u (v T0))│┌───────────────────────┐│┌──────────┬─────────────────────────────────────┐│ │ ││┌──────────┬──────────┐│││(u (v T3))│┌───────────┬───────────┬───────────┐││ │ │││(u (v T1))│(u (v T2))││││ ││(u (v T00))│(u (v T01))│(u (v T02))│││ │ ││└──────────┴──────────┘│││ │├───────────┼───────────┼───────────┤││ │ │└───────────────────────┘││ ││(u (v T10))│(u (v T11))│(u (v T12))│││ │ │ ││ │└───────────┴───────────┴───────────┘││ │ │ │└──────────┴─────────────────────────────────────┘│ └──────────┴─────────────────────────┴──────────────────────────────────────────────────┘ (u @: v)l T ┌──────────┬─────────────────────────┬──────────────────────────────────────────────────┐ │(u (v T0))│┌───────────────────────┐│┌──────────┬─────────────────────────────────────┐│ │ ││┌──────────┬──────────┐│││(u (v T3))│┌───────────┬───────────┬───────────┐││ │ │││(u (v T1))│(u (v T2))││││ ││(u (v T00))│(u (v T01))│(u (v T02))│││ │ ││└──────────┴──────────┘│││ │├───────────┼───────────┼───────────┤││ │ │└───────────────────────┘││ ││(u (v T10))│(u (v T11))│(u (v T12))│││ │ │ ││ │└───────────┴───────────┴───────────┘││ │ │ │└──────────┴─────────────────────────────────────┘│ └──────────┴─────────────────────────┴──────────────────────────────────────────────────┘ ((u l @: (v l)) -: (u @: v)l ) T 1 In mathematics, if I recall correctly, a function is defined by the “rule” that ties each argument with its value and the domain of its arguments (and the codomain of its values). The domain of a dyadic verb can be thought as the Cartesian product of the domains of the left and right arguments and it is reassuring to see that, S (u l @: (v l)) T ┌─────────────┬───────────────────────────────┬─────────────────────────────────────────────────────────────────┐ │(u (S0 v T0))│┌─────────────────────────────┐│┌─────────────┬─────────────────────────────────────────────────┐│ │ ││┌─────────────┬─────────────┐│││(u (S3 v T3))│┌───────────────┬───────────────┬───────────────┐││ │ │││(u (S1 v T1))│(u (S2 v T2))││││ ││(u (S00 v T00))│(u (S01 v T01))│(u (S02 v T02))│││ │ ││└─────────────┴─────────────┘│││ │├───────────────┼───────────────┼───────────────┤││ │ │└─────────────────────────────┘││ ││(u (S10 v T10))│(u (S11 v T11))│(u (S12 v T12))│││ │ │ ││ │└───────────────┴───────────────┴───────────────┘││ │ │ │└─────────────┴─────────────────────────────────────────────────┘│ └─────────────┴───────────────────────────────┴─────────────────────────────────────────────────────────────────┘ S (u @: v)l T ┌─────────────┬───────────────────────────────┬─────────────────────────────────────────────────────────────────┐ │(u (S0 v T0))│┌─────────────────────────────┐│┌─────────────┬─────────────────────────────────────────────────┐│ │ ││┌─────────────┬─────────────┐│││(u (S3 v T3))│┌───────────────┬───────────────┬───────────────┐││ │ │││(u (S1 v T1))│(u (S2 v T2))││││ ││(u (S00 v T00))│(u (S01 v T01))│(u (S02 v T02))│││ │ ││└─────────────┴─────────────┘│││ │├───────────────┼───────────────┼───────────────┤││ │ │└─────────────────────────────┘││ ││(u (S10 v T10))│(u (S11 v T11))│(u (S12 v T12))│││ │ │ ││ │└───────────────┴───────────────┴───────────────┘││ │ │ │└─────────────┴─────────────────────────────────────────────────┘│ └─────────────┴───────────────────────────────┴─────────────────────────────────────────────────────────────────┘ S ((u l @: (v l)) -: (u @: v)l ) T 1 Likewise, (u l &: (v l)) T ┌──────────┬─────────────────────────┬──────────────────────────────────────────────────┐ │(u (v T0))│┌───────────────────────┐│┌──────────┬─────────────────────────────────────┐│ │ ││┌──────────┬──────────┐│││(u (v T3))│┌───────────┬───────────┬───────────┐││ │ │││(u (v T1))│(u (v T2))││││ ││(u (v T00))│(u (v T01))│(u (v T02))│││ │ ││└──────────┴──────────┘│││ │├───────────┼───────────┼───────────┤││ │ │└───────────────────────┘││ ││(u (v T10))│(u (v T11))│(u (v T12))│││ │ │ ││ │└───────────┴───────────┴───────────┘││ │ │ │└──────────┴─────────────────────────────────────┘│ └──────────┴─────────────────────────┴──────────────────────────────────────────────────┘ (u &: v)l T ┌──────────┬─────────────────────────┬──────────────────────────────────────────────────┐ │(u (v T0))│┌───────────────────────┐│┌──────────┬─────────────────────────────────────┐│ │ ││┌──────────┬──────────┐│││(u (v T3))│┌───────────┬───────────┬───────────┐││ │ │││(u (v T1))│(u (v T2))││││ ││(u (v T00))│(u (v T01))│(u (v T02))│││ │ ││└──────────┴──────────┘│││ │├───────────┼───────────┼───────────┤││ │ │└───────────────────────┘││ ││(u (v T10))│(u (v T11))│(u (v T12))│││ │ │ ││ │└───────────┴───────────┴───────────┘││ │ │ │└──────────┴─────────────────────────────────────┘│ └──────────┴─────────────────────────┴──────────────────────────────────────────────────┘ ((u l &: (v l)) -: (u &: v)l ) T 1 S (u l &: (v l)) T ┌─────────────────┬───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ │((v S0) u (v T0))│┌─────────────────────────────────────┐│┌─────────────────┬─────────────────────────────────────────────────────────────┐│ │ ││┌─────────────────┬─────────────────┐│││((v S3) u (v T3))│┌───────────────────┬───────────────────┬───────────────────┐││ │ │││((v S1) u (v T1))│((v S2) u (v T2))││││ ││((v S00) u (v T00))│((v S01) u (v T01))│((v S02) u (v T02))│││ │ ││└─────────────────┴─────────────────┘│││ │├───────────────────┼───────────────────┼───────────────────┤││ │ │└─────────────────────────────────────┘││ ││((v S10) u (v T10))│((v S11) u (v T11))│((v S12) u (v T12))│││ │ │ ││ │└───────────────────┴───────────────────┴───────────────────┘││ │ │ │└─────────────────┴─────────────────────────────────────────────────────────────┘│ └─────────────────┴───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘ S (u &: v)l T ┌─────────────────┬───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ │((v S0) u (v T0))│┌─────────────────────────────────────┐│┌─────────────────┬─────────────────────────────────────────────────────────────┐│ │ ││┌─────────────────┬─────────────────┐│││((v S3) u (v T3))│┌───────────────────┬───────────────────┬───────────────────┐││ │ │││((v S1) u (v T1))│((v S2) u (v T2))││││ ││((v S00) u (v T00))│((v S01) u (v T01))│((v S02) u (v T02))│││ │ ││└─────────────────┴─────────────────┘│││ │├───────────────────┼───────────────────┼───────────────────┤││ │ │└─────────────────────────────────────┘││ ││((v S10) u (v T10))│((v S11) u (v T11))│((v S12) u (v T12))│││ │ │ ││ │└───────────────────┴───────────────────┴───────────────────┘││ │ │ │└─────────────────┴─────────────────────────────────────────────────────────────┘│ └─────────────────┴───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘ S((u l &: (v l)) -: (u &: v)l ) T 1 and ( u v vv)l T ┌──────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────┐ │((u T0) v (vv T0))│┌───────────────────────────────────────┐│┌──────────────────┬────────────────────────────────────────────────────────────────┐│ │ ││┌──────────────────┬──────────────────┐│││((u T3) v (vv T3))│┌────────────────────┬────────────────────┬────────────────────┐││ │ │││((u T1) v (vv T1))│((u T2) v (vv T2))││││ ││((u T00) v (vv T00))│((u T01) v (vv T01))│((u T02) v (vv T02))│││ │ ││└──────────────────┴──────────────────┘│││ │├────────────────────┼────────────────────┼────────────────────┤││ │ │└───────────────────────────────────────┘││ ││((u T10) v (vv T10))│((u T11) v (vv T11))│((u T12) v (vv T12))│││ │ │ ││ │└────────────────────┴────────────────────┴────────────────────┘││ │ │ │└──────────────────┴────────────────────────────────────────────────────────────────┘│ └──────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────┘ (u l v l vv l) T ┌──────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────┐ │((u T0) v (vv T0))│┌───────────────────────────────────────┐│┌──────────────────┬────────────────────────────────────────────────────────────────┐│ │ ││┌──────────────────┬──────────────────┐│││((u T3) v (vv T3))│┌────────────────────┬────────────────────┬────────────────────┐││ │ │││((u T1) v (vv T1))│((u T2) v (vv T2))││││ ││((u T00) v (vv T00))│((u T01) v (vv T01))│((u T02) v (vv T02))│││ │ ││└──────────────────┴──────────────────┘│││ │├────────────────────┼────────────────────┼────────────────────┤││ │ │└───────────────────────────────────────┘││ ││((u T10) v (vv T10))│((u T11) v (vv T11))│((u T12) v (vv T12))│││ │ │ ││ │└────────────────────┴────────────────────┴────────────────────┘││ │ │ │└──────────────────┴────────────────────────────────────────────────────────────────┘│ └──────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────┘ ((( u v vv)l) -: (u l v l vv l)) T 1 S ( u v vv)l T ┌────────────────────────┬─────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │((S0 u T0) v (S0 vv T0))│┌───────────────────────────────────────────────────┐│┌────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────┐│ │ ││┌────────────────────────┬────────────────────────┐│││((S3 u T3) v (S3 vv T3))│┌────────────────────────────┬────────────────────────────┬────────────────────────────┐││ │ │││((S1 u T1) v (S1 vv T1))│((S2 u T2) v (S2 vv T2))││││ ││((S00 u T00) v (S00 vv T00))│((S01 u T01) v (S01 vv T01))│((S02 u T02) v (S02 vv T02))│││ │ ││└────────────────────────┴────────────────────────┘│││ │├────────────────────────────┼────────────────────────────┼────────────────────────────┤││ │ │└───────────────────────────────────────────────────┘││ ││((S10 u T10) v (S10 vv T10))│((S11 u T11) v (S11 vv T11))│((S12 u T12) v (S12 vv T12))│││ │ │ ││ │└────────────────────────────┴────────────────────────────┴────────────────────────────┘││ │ │ │└────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────┘│ └────────────────────────┴─────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ S (u l v l vv l) T ┌────────────────────────┬─────────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │((S0 u T0) v (S0 vv T0))│┌───────────────────────────────────────────────────┐│┌────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────┐│ │ ││┌────────────────────────┬────────────────────────┐│││((S3 u T3) v (S3 vv T3))│┌────────────────────────────┬────────────────────────────┬────────────────────────────┐││ │ │││((S1 u T1) v (S1 vv T1))│((S2 u T2) v (S2 vv T2))││││ ││((S00 u T00) v (S00 vv T00))│((S01 u T01) v (S01 vv T01))│((S02 u T02) v (S02 vv T02))│││ │ ││└────────────────────────┴────────────────────────┘│││ │├────────────────────────────┼────────────────────────────┼────────────────────────────┤││ │ │└───────────────────────────────────────────────────┘││ ││((S10 u T10) v (S10 vv T10))│((S11 u T11) v (S11 vv T11))│((S12 u T12) v (S12 vv T12))│││ │ │ ││ │└────────────────────────────┴────────────────────────────┴────────────────────────────┘││ │ │ │└────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────┘│ └────────────────────────┴─────────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ S ((( u v vv)l) -: (u l v l vv l)) T 1 I am fully aware that the above expressions are not “proofs” and they can be misleading, for example, ((u @: v) @: vv)l T ┌───────────────┬───────────────────────────────────┬──────────────────────────────────────────────────────────────────────┐ │(u (v (vv T0)))│┌─────────────────────────────────┐│┌───────────────┬────────────────────────────────────────────────────┐│ │ ││┌───────────────┬───────────────┐│││(u (v (vv T3)))│┌────────────────┬────────────────┬────────────────┐││ │ │││(u (v (vv T1)))│(u (v (vv T2)))││││ ││(u (v (vv T00)))│(u (v (vv T01)))│(u (v (vv T02)))│││ │ ││└───────────────┴───────────────┘│││ │├────────────────┼────────────────┼────────────────┤││ │ │└─────────────────────────────────┘││ ││(u (v (vv T10)))│(u (v (vv T11)))│(u (v (vv T12)))│││ │ │ ││ │└────────────────┴────────────────┴────────────────┘││ │ │ │└───────────────┴────────────────────────────────────────────────────┘│ └───────────────┴───────────────────────────────────┴──────────────────────────────────────────────────────────────────────┘ (u @: (v @: vv))l T ┌───────────────┬───────────────────────────────────┬──────────────────────────────────────────────────────────────────────┐ │(u (v (vv T0)))│┌─────────────────────────────────┐│┌───────────────┬────────────────────────────────────────────────────┐│ │ ││┌───────────────┬───────────────┐│││(u (v (vv T3)))│┌────────────────┬────────────────┬────────────────┐││ │ │││(u (v (vv T1)))│(u (v (vv T2)))││││ ││(u (v (vv T00)))│(u (v (vv T01)))│(u (v (vv T02)))│││ │ ││└───────────────┴───────────────┘│││ │├────────────────┼────────────────┼────────────────┤││ │ │└─────────────────────────────────┘││ ││(u (v (vv T10)))│(u (v (vv T11)))│(u (v (vv T12)))│││ │ │ ││ │└────────────────┴────────────────┴────────────────┘││ │ │ │└───────────────┴────────────────────────────────────────────────────┘│ └───────────────┴───────────────────────────────────┴──────────────────────────────────────────────────────────────────────┘ (((u @: v) @: vv)l -: (u @: (v @: vv))l) T 1 The above might be suggesting that (@:) inherits the associative property of function composition. Yet, the associativity does not always hold for (@:), or (@), not even for a simple argument (and I do not even know if that is a feature or a bug). In mathematics is often assumed that one can perform supertasks and hypertasks but when using J (or any other Turing complete language) to define function rules, determining the domain is, in general, practically impossible because the verb might or might not terminate. However, apparently mathematically one can easily and happily define an indicator function for the computable real numbers in the interval [0,1] as 1 if it is or 0 if is not computable. One can even argue that if we pick one argument at random its corresponding indicator function value would be 1 with probability 1; yet, once an specific argument is drawn it would be almost always impossible to determine with certainty what its corresponding function value is (one is assuming again, of course, that one could really draw an actual number uniformly distributed on [0,1]). At any rate, I have gained some insights about the (L:) conjunction in general and (L:0) and (L:_1) in particular (it is now more clear to me why the latter behaves similar to (&.>) while preserving some structural features of the modified verb arguments). ________________________________________ From: programming-boun...@jsoftware.com [programming-boun...@jsoftware.com] on behalf of William Tanksley, Jr [wtanksle...@gmail.com] Sent: Thursday, March 29, 2012 11:03 AM To: Programming forum Subject: Re: [Jprogramming] J functors Boyko Bantchev <boyk...@gmail.com> wrote: >> Definitions do not eliminate ambiguity. > Speaking of formal definitions, I would say they ought to. There is > not much use of defining formally and ambiguously. There is a formal definition for "formal". It does not mean "unambiguous". In fact, it turns out that we can formally prove that a finite formal definition will always be ambiguous when applied to a set whose formal description is larger than the formal description of the definition itself. (I'm not formally stating that, though.) "Formal" means that we can manipulate objects without caring about their meaning, only caring about their __form__. The only way to make a formal definition unambiguous is to restrict its applicability to a finite area, and to describe that entire area. Unfortunately, since mathematics is infinite and space is very big, someone will probably find a way to find an area that exactly fits the FORM of your formal definition, but is in a different context. Fortunately, the resulting surprises can sometimes be pleasant -- as when Wildberger elaborated the ancient Greek rational trigonometry and discovered that all of the classical results (Euler's line, 9-point circle, etc) hold for triangles in hyperbolic and elliptic geometries (a fact that does not hold for modern trigonometry!) -- and then he found that the results for the three geometries applied to the same triangle have a simple, symmetric interrelationship. -Wm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ________________________________________ From: programming-boun...@jsoftware.com [programming-boun...@jsoftware.com] on behalf of Boyko Bantchev [boyk...@gmail.com] Sent: Thursday, March 29, 2012 9:07 AM To: Programming forum Subject: Re: [Jprogramming] J functors >> @: (or &:) is said to produce a verb of infinite ranks (of which, >> here, we are only interested in the monadic case). As I understand >> it, this can only be achieved by modifying the ranks of the arguments >> and/or the rank of the result. > > The rank of a verb is a part of the definition of the verb, which > makes it independent of any arguments. You are apparently misreading. I've been discussing conjunctions and the ranks of _their_ arguments. Those arguments are verbs. I said nothing about the arguments of any verbs. >> Whatever it is, @: is different from @. > > Note that @. and @ are different words in J, with entirely different meanings. Aren't you misreading the fullstop at the end of a sentence as something else? I never mentioned @. in my post. >> Therefore, if f@g (again, monadic) is the composition >> in the usual mathematical sense (as asserted in the DoJ), >> then f@:g is not it. > > The truth of this statement depends on the definitions of f and g, and > on the domain under consideration. Not at all. The truth of the sentence (especially in view of its preceding context) depends on whether f@:g is equivalent to f@g for any pair of arguments f,g. Which it isn't. Considering particular cases for f,g does not help it. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ________________________________________ From: programming-boun...@jsoftware.com [programming-boun...@jsoftware.com] on behalf of Raul Miller [rauldmil...@gmail.com] Sent: Thursday, March 29, 2012 9:04 AM To: Programming forum Subject: Re: [Jprogramming] J functors On Wed, Mar 28, 2012 at 6:27 PM, Boyko Bantchev <boyk...@gmail.com> wrote: >>> (f?g)(x) ≡ f(g(x)) >> >> Definitions do not eliminate ambiguity. > > Speaking of formal definitions, I would say they ought to. There is > not much use of defining formally and ambiguously. And yet, f and g are not defined here, and neither are x. (And, for that matter, the grammar associated with parenthesis are not defined here.) Thus, formal definitions depend on the definitions of the symbols used in the definition. More generally, Mathematics deals with numerous definitions for the symbols it uses. There are numerous branches of mathematics, each with their own conventions for these definitions. >> One issue, here, is that the definitions of f, g and x are contextual. > > What do you mean by 'contextual'? I mean that, for example, the definition of x depends on the context where the phrase that contains x is used. My point was that a reference to "Mathematics" as a whole is not very satisfying. > Is it related to the above definition of ? (composition)? Because f, > g and x are just formal names there, locally bound within > the definition - none of them is a free variable, so there is > no context. In one context, x might be 1 In another context, x might be 2 In another context, x never be positive In one context, x might be a constant In another context, x might be a free variable In another context, x might be a function of f In another context, x might be the set R3 In another context, x might be a member of the set R3 ... These might seem to be trivial variations, but they are relevant when understanding the significance of a sentence which contains x. > (Expressed in plain language, the definition says the following: > composition (?) of f on g, where f and g are any two functions such > that the domain of f includes the codomain of g, is a function which, > given any argument from the domain of g, returns the result of > applying f to the result of applying g to x.) Yes, and where x is in the domain of f?g... And yet none of these statements were part of that "formal definition". >> A variant on this issue is >> that in the realm of general mathematics, a function that maps from A >> to B can also map from C to D. And, A and C might have a non-empty >> intersection and yet not have a subset relationship between them and >> composition might be valid for A and not C. > > How can a function have two different domains without being in fact > two different functions? Doesn't make sense to me. A domain is the set of argument values for which a function is defined. A function can have multiple definitions. These definitions do not need to conflict. How else can we talk about extending a function defined on integers to be a function defined on real numbers? >> All of these J phrases can be used to >> represent composition between functions represented by f and g, if f >> and g are verbs: >> f at g Note: this was an edit introduced by some mail software. I had written the symbol '@' here, and some unknown piece of software replaced that with ' at ' before relaying it to the mailing list. >> f@:g >> f&g >> f&:g >> ([: f g) >> f(g(x)) > > I assume that by 'f at g' you mean f@g ... Yes. > Now, not all of the above represent a composition. f@g and f&g, > in their monadic cases, are equivalent by definition, and are > compositions. f@:g and f&:g (in their monadic cases) are equivalent > but are not the composition of f on g; what they compose is the > results of changing (the ranks of) their arguments rather than the > arguments themselves. The same holds of [: f g (in its monadic case). No ranks are changed. The rank of the derived verb will sometimes be different, for different sentences. But whether this is a significant issue depends on the domain under consideration. >> Note also that that last phrase >> represents composition if x is a noun. It might also represent >> composition if x was an appropriate adverb (for example: x=:1 :'@u') > > In neither case is it a composition. If x is a noun, f(g(x)) does > not even represent a verb. Your formal definition did not require that a verb be produced. So why is this an issue now? > If x is an adverb, so that g(x) is a verb, then f(g(x)) is a hook > - again, not a composition. I do not know what you are talking about here. Here's from a J session. I am using & here so that I will not experience mail system corruption of the ascii character @ f(g(x)) f&g If f&g is composition then clearly f(g(x)) is composition. > We have to stick to the mathematical meaning of composition because > this is what the definition of functor depends on, and we were > discussing functors ... Except we seem to have new constraints appearing as new examples are introduced? >>> The domain of a composition operator are functions themselves, >>> not the data structures that are domains of those functions. >>> A 'composition' that has to do with data structures is anything >>> else but composition of functions. >> >> You seem to be saying that context is irrelevant. > > The context of what? In defining composition, I see no context at all. The context under consideration. This is the context that supplies definitions for the functions and which defines their domains. >> And, some operations can be performed efficiently in compiled >> haskell and are inefficient in interpreted haskell. > > Yes, but that is nothing to wonder at - the same can be said of > any language that admits both modes of execution. And it doesn't > necessarily mean that such a language, when interpreted, is slower > than a language which is only interpreted. Whichever is faster > would also depend, I guess, on the problem being solved, as well as > on the language constructs and programming techniques used in the > solutions. Well.. I downloaded and tested a Haskell interpreter yesterday, and I do have to admit that it behaved much better than previous interpreters that I had tried (years ago). Still, every language has to deal with time/space tradeoffs in some fashion, and some cases can be resource intensive, and some of those resource intensive cases can be made more efficient by expending resources at compile time. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm [BEST LLC] Bayesian Efficient Strategic Trading LLC The information in this communication and any attachment is confidential and intended solely for the attention and use of the named addressee(s). Any views or opinions presented are solely those of the author and do not necessarily represent those of BEAM Bayesian Efficient Asset Management, LLC (BEAM), Bayesian Efficient Strategic Trading, LLC (BEST) and/or their affiliates unless otherwise specifically stated. All information and opinions expressed herein are subject to change without notice. This communication is not to be construed as an offer to sell or the solicitation of an offer to buy any security. Any reliance one may place on the accuracy or validity of this information is at their own risk. Past performance is not necessarily indicative of the future results of an investment. If you are not the intended recipient, or a person responsible for delivering this to the intended recipient, you are not authorized to and must not disclose, copy, distribute, or retain this message or any part of it. If you are not the intended recipient, please permanently delete all copies of this communication and any attachments from your computer system, destroy any hard copies, and immediately notify the sender or BEAM/BEST at either i...@2bestsystems.com, i...@beamstrategy.com or (201) 792-1002. No waiver of confidentiality or privilege is made by mistransmission. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm