You are executing the derived verb from Y as a monad. You need to lose
the : in Y.
Henry Rich
On 11/30/2018 4:05 PM, Raul Miller wrote:
Sure...
If I define:
Y0=:1 :0
f=. u Defer
(5!:1<'f') f y
)
Defer=: 1 :0
:
g=. x&(x`:6)
(5!:1<'g') u y
)
and I also define
almost_factorial=: 4 :0
if. 0 >: y do. 1
else. y * x`:6 y-1 end.
)
Then
almost_factorial Y0 9
362880
Similarly, if I define:
Y2=:1 :0
f=. u f.1 :(':';'g=. x&(x`:6)';'(5!:1<''g'') u y')
(5!:1<'f') f y
)
Then
almost_factorial Y2 9
362880
But
almost_factorial Y 9
|domain error
Thanks,
---
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm