Roger Hui <[email protected]> wrote: > > 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.
Of course these are necessary for function composition, and anyone familiar with function composition would understand why identity functions are necessary. I was, however, speaking about people who are coming from backgrounds without such concepts. Most popular programming languages don't have inverses and function composition, so the idea of writing a special function "z =: f(y)" that yields "z =: y" would appear redundant, since nobody would ever explicitly call it; one could just always write "z =: y". (Of course, one COULD always write such a function, but its usefulness would be limited, and not useful enough to be included as a language primitive). (C does include the operator +x, but who ever writes +x instead of just x? Besides, it's not a true identity since it doesn't work with structures, much like _9&o. is only an identity with respect to numeric values). Similarly, a function like [: that always yields a domain error is useful for composition (e.g. monadonly =: monad : [:) but is not otherwise useful - people generally don't write code that is intended to always fail. In fact, J itself recognizes this fact by not interpreting ([: u v) as written (i.e. invoke v, then always throw a domain error); rather, it replaces this with the much more useful capped fork idiom. You yourself expressed similar notions of redundancy as justification for removing identity operators Lev, Dex, and Identity from J 5 (as they were no longer used for making operator trains; presumably there is otherwise insufficient use for identity operators). -- Mark D. Niemiec <[email protected]> ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
