Igor Zhuravlov has proposed a language extension to specifically address this
problem:
Proposal:
http://www.jsoftware.com/jwiki/System/Interpreter/Requests#extendEvokeGerund
Details:
http://www.jsoftware.com/jwiki/IgorZhuravlov/Extended%20forks
Script:
http://www.jsoftware.com/jwiki/IgorZhuravlov/Extended%20forks?action=AttachFile&do=get&target=fork.ijs
This is a very exciting idea to me, but I've yet to play with it enough to make
any further comments. But AFAIK the problem you
describe is intrinsic to the language as it is defined today.
This is a result of two facts: verbs can refer to 2 arguments at most, and
tacit code cannot refer to mutable state (so we can't
have any "local variables/not-immediately-adjacent precalculated values")
without resorting to boxing and later unboxing, which
requires a lot of obscurant data structuring code (which is common in other
languages, but interferes with J's native elegance).
A recent victim of this pox (excessive dots everywhere :) that springs to mind
is the tacit "Markov algorithm", which you can see at
[1] and compare to its healthy local-variable-ish explicit counterpart.
-Dan
PS : I have found a way to generalize Igor's fork3, fork4,
fork5 .... verbs into a single forkN verb. The short
answer is \. , more later if anyone's interested.
PPS to Tracy: I haven't forgotten about your # substitution code. I'll send
you something regarding that after my trip.
[1] Poxy tacit version and healthy explicit version of a Markov engine:
http://rosettacode.org/wiki/Talk:Markov_Algorithm#explicit_vs_tacit
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm