I wrote:
> If I were converting a C program to J, I might re-write all
> the nested conditionals as select statements. Then I would
> phrase those statements in J using agenda @. , like
> tni =: [EMAIL PROTECTED](cond1 (* >:)&:-. cond2)
I should have made clearer that @. can function directly as if. clause,
rather than the more general select. . And that you
may nest them.
That is, you needn't "flatten" your nested conditions as I did above. I just
happen to have found that pattern more useful in my
J career. But you can certainly translate more directly:
tnI =: [EMAIL PROTECTED]@.cond1
tnI 3
2
tnI 110
55
tnI 48
48
Further, this pattern addresses my last two cavaets. Its primary drawback is
that it's less J like: you shouldn't make too many
small decisions.
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm