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
