Thanks Ambrus, that makes sense. I was thinking that eg1 wouldn't be
applied until stc finished execution, meaning until the recursion had
bottomed out, but I can see now why J tries to execute eg1 with the adverb h
stc as an argument before the recursion is invoked.
As for a workaround, yes: my current (unsatisfying) solution inspects &
modifies stc in the manner you describe, through code generation. It works,
but I was hoping for a lighter weight solution.
On an related note, Pepe once identified an interesting "bug" in J:
http://www.jsoftware.com/pipermail/programming/2008-February/009871.html
to wit: it used to be possible to pass operators as arguments to operators.
He pointed this out to Roger, who immediately closed the hole. This change
may be exactly what prevents me from achieving my goal. I'm going to fire
up an old J and find out (I'm almost positive that if I go back far enough
to get the trains table, I could do this, but I'm interested if I could do
by just leveraging Pepe's bug).
More generally, the fact that I can't consume operators as arguments (except
as quoted names) frequently frustrates my efforts at metaprogramming, and I
think J would be a richer language if it permitted this.
But if we were going to make this change (we're not), we should have the
courage of our convictions, and change the Dictionary to match. Otherwise,
it really is a bug.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm