Hello, I have this recursive dyad defined to calculate modular matrix exponential by squaring:
pow =: 4 : 0 if. y = 1 do. x else. (] ` (x & mul) @. (2 | y)) mul~ x pow <. -: y end. ) (mul verb can be defined to perform simple multiplication, then it will work for regular numbers as well) I'd like to convert the if statement into a gerund followed by agenda. I tried the following, but that doesn't seem to work. pow =: 4 : 0 ((] ` (x & mul) @. (2 | y)) mul~ x pow <. -: y) ` x @. (y = 1) ) I tried a few other variations, but to no avail. What I am doing wrong? Thanks, Eugene ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm