The gerund argument to @. must be all verbs
`(x"_) fixes the rightmost one
for the left one, the simplest way, you could enclose the operation with 4 : as
in
4 : '(] ` (x & mul) @. (2 | y)) mul~ x pow <. -: y'
On Monday, September 9, 2019, 12:49:39 p.m. EDT, Eugene Nonko
<[email protected]> wrote:
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm