Please elaborate on benefit 3: 3. There is some prospect of being able to do symbolic calculations efficiently.
----- Original Message ----- From: John Randall <[EMAIL PROTECTED]> Date: Monday, July 3, 2006 11:47 am Subject: Re: [Jgeneral] J as a functional programming language > R&S HUI wrote: > > Memoization can be introduced as an adverb, so that > > instead of the system guessing whether a verb can be > > memoized, you'd say: > > > > v M. > > > > v M. would give exactly the same results as v but would > > be memoized. > > > Roger: > > I think this would be an excellent idea. Brian Schott emailed me a > link to > a previous post along these lines, and I hope this gets seriously > considered for a future version of J. > > To me, the main benefits would be: > > 1. In interactive use, a memoized verb can return the results of a > longcalculation immediately, even if the result has not been > assigned to a > name. > > 2. Recursive functions can be written more directly. > > 3. There is some prospect of being able to do symbolic calculations > efficiently. > > In addition, a memoization facility is increasingly seen as > important in > mainstream languages. > > > I don't see that comparison tolerance necessarily presents > > insurmountable difficulties. The global tolerance is > > problematic, but the v!.t version should be fine. > > > > I mentioned comparison tolerance because you have to decide > whether v y > has been previously computed, and so you need to compare y with > argumentsfor which the value of v is known. If v!.t sets this > argument tolerance, > then I do not see a problem. > > As Jose Mario Quintana points out, functions without side effects > are good > candidates for parallelism. J already encourages not having side > effects,since the order of cells to which a verb is applied is > unspecified. This > feature of functional programming is something I do not know how to > directly exploit. > > > What are the problems with ? for functional programming, > > other than the definitional one? Whatever functional > > programming is, it would be poorer if it can not > > accommodate ? (rule out Monte Carlo methods, etc.) > > > There are certainly ways around ?, as Raul Miller has mentioned. > In my > original post I was indicating that naively used, ? has two strikes > against it: its value does not just depend on its arguments, and > it has > side effects. > > I am no functional programming zealot, but I think J can take > advantage of > some of its ideas, just as John Backus took some inspiration for > FP from > APL. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
