On 9 August 2011 18:54, Devon McCormick <[email protected]> wrote: > .............. > way to avoid looping by using arrays rather than recursion which seems to be > a common iteration method in functional languages. Ideally, I'd like an > example where I can show both an array-based solution and work in some of > J's iterative methods as well - things like scan and the power conjunction.
Since the audience is functional programmers, I guess stressing on arrays as contrasted to linked lists would be a very good idea. Modern functional languages have many features in common with J. One is easy formation of function-valued expressions (through not only lambdas, but also composition, partial application, etc). They also offer much to aid the programmer in avoiding explicit recursion through the use of map, filter, folds, zips, etc. Still, J has a clear advantage over most functional languages by its basic data sructure being a random-access array rather than a linked -- and therefore unidirectional -- list. Linked lists may be awkward when speed is important, and do not easily lend themselves to parallel processing. (I personally believe that relying so heavily on linked lists in those languages is a mistake, a legacy from Lisp that they should have got rid of long ago.) So, I would guess that a functional programmer would be interested, on the one hand, in seeing how certain things are done in J similarly to what they already know and practice in their languages. This, on the other hand, is a good starting point for also showing significant differences, such as: arrays vs. lists; map being implicit and rank-dependent, etc. I am unable to come up with a really good example right now, though. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
