> From: Don Watson <[email protected]> > > Why can I write: > > %:<.-:# y > > but have to change it when I want to store a verb that does the same thing > to: > > answer =: %:@:<.@:-:@:# >
I believe this highlights the key point of S. 1. I see a problem here: S tries design a new notation for the same complex apparatus of tacit definition. The complexity is intrinsic, and there is hardly a way to reduce it with a different notation. It just makes it more confusing. There is just no way that tacit definition in any form is going to be readily perceivable for beginners. For example take "@". It corresponds to function composition in mathematics. It is easy to define the chain rule for its derivative: (c...@sin f.) d. 1 NB. (cos o sin)' 2&o. * -@(1&o.)@(1&o.) NB. (cos' o sin) * sin' = (-sin o sin) * cos However to be able to use this apparatus one has already to be at a more advanced stage in mathematics. By that time the notion of tacit, first shown with "@" as above will not be a problem. 2. An alternative is to use only explicit or direct definitions. The existing mechanism for explicit definition in J allows for compact one line representation: answer=: verb : '%:<.-:# y' plus =: dyad : 'x + y' However if this seems too contrived, there is the concept of Direct Definition. It is also known as DEF, DFNS, alpha-omega representation. http://www.google.com/search?q="direct+definition"&sitesearch=jsoftware.com In the pre-college mathematics books by Kenneth Iverson, where APL was used, there was no tacit programming and it was sufficient. J without tacit programming can cover the same features as APL. The evolution of notation can be traced in "Elementary Functions" (1966, "boxy" definitions) and "Algebra", (1972, DEL definitions) and in "Elementary Analysis" (1976, direct definitions). http://www.jsoftware.com/jwiki/Essays/Bibliography While it was probably formally defined in "Direct Definition" (1980), the "Elementary Analysis" book also contains a logically consecutive section how direct definition is constructed and represented. Yours truly made an attempt to mimic direct definitions in J http://www.jsoftware.com/jwiki/Phrases/Definitions it is for use in scripts. However, more convenient would be to use it in interactive session mode, possibly with the "prompt" script to emulate quote-quad. In Dyalog APL they have recently added direct definition and use it extensively, thinking that "in spirit" it is close to tacit. http://www.jsoftware.com/pipermail/chat/2007-December/000849.html So my suggestion is to limit the scope, avoid complex stuff, use existing simpler subset of J and/or possibly adapt the environment (session) for a more readily attainable notation. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
