> To someone who is unfamiliar with J, the existence of verbs [ and ] > (let alone [: which always fails) might seem incomprehensible. > However, these are all necessary for the formation of trains. > (A similar dynamic exists with respect to the existence of > silent letters in spoken languages).
You have your mathematics and your history wrong. [ and ] are nothing but identity functions, familiar and essential in mathematics (how else do you express the composition of f and f inverse?) and introduced to APL years before trains were thought of. [: is just a function whose monadic, left, and right domains are empty. ----- Original Message ----- From: Mark Niemiec <[email protected]> Date: Thursday, July 30, 2009 21:53 Subject: Re: [Jprogramming] Third argument To: J Programming Forum <[email protected]> > neville holmes <[email protected]> wrote: > > > Indeed the problem with lex and dev was that they > > were defined to be operators for no particular > > reason that I could see with my inexpert eye. > > To someone who is unfamiliar with J, the existence of verbs [ and ] > (let alone [: which always fails) might seem incomprehensible. > However, these are all necessary for the formation of trains. > (A similar dynamic exists with respect to the existence of > silent letters in spoken languages). > > Similarly, [. and ]. and ]: would also seem to be useless, but > they were > very useful for the formation of operator trains. > For those unfamiliar with J 4, these were equivalent to: > [. =: 2 : 'u' NB. Lev > ]. =: 2 : 'v' NB. Dex > ]: =: 1 : 'u' NB. Identity > > J 4 also had a rich syntax that allowed creation of tacit operators. > (J 6 retains a small portion of this, allowing creation of tacit > adverbs, but tacit operators with two parameters are no longer > possible). > For example, (C V C) was equivalent to 2 : 'u C0 v V1 u C2 v' > One trick you could do is make functions with the syntax of operators > but the semantics of verbs (in much the same way that m"_ creates > functions with the syntax of verbs but the semantics of nouns). > With these, one could simulate a two-level operator-priority paradigm. > For example: > > times =: [.*]. NB. times =: 2 : 'u*v' > 4 times 100 + 3 times 10 > 430 > factorial =: [.(!@:[)].0 NB. factorial =: 1 : '!u' > 6 factorial + 3 factorial > 726 > > -- Mark D. Niemiec <[email protected]> > ----------------------------------------------------------------- > ----- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
