2011/9/25 Nick Simicich <[email protected]>:
> APL, is a way was simpler, nothing worked from left to right, everything
> worked from right to left. I understand why conjunctions have to bind left
> to right, I think, but what I don't understand is why
> (5&{.!.1) /. (5 5 $i. 25)
> fails while yours yours works.
I do not remember APL's rules for user defined "operators" and their
precedence, but watch this:
$ (5&{.!.1) /. (5 5 $i. 25)
|domain error
| $( 5&{.!.1)/.(5 5$i.25)
$ 5&({.!.1) /. (5 5 $i. 25)
9 5
In the first case, !.1 is trying to modify 5&{. and it does not know how.
In the second case, 5& is deriving a new verb based on {.!.1 and that works.
> I first went looking to see if I could specify a fill to unbox, but there is
> no such operation.
There is no such operation, but if you are working with numbers that
kind of result is easy to achieve:
]/.&.:(-&1) i.3 3
0 1 1
1 3 1
2 4 6
5 7 1
8 1 1
]/.&.:(-&2) i.3 3
0 2 2
1 3 2
2 4 6
5 7 2
8 2 2
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm