On Fri, Feb 19, 2010 at 12:19 AM, Devon McCormick <[email protected]> wrote:
> For further thought, why is this OK
>
>   14 */@(-i.) 3 2
> 1680 1287
>
> but I get this error here?
>
>   14 */@(-i.) i. 14
> |limit error

The way we defined that verb, it won't automatically work for an array
of numbers.  J builtins that do numerical computations on single
numbers are defined to be extended to arrays.  For example, ^!._1 is
such a builtin, so we get

   14 ^!._1 i. 9
1 14 182 2184 24024 240240 2162160 17297280 121080960

Other builtins and user functions do use array arguments as a whole,
so J won't automatically apply our defined verbs to each element,
which is why the above doesn't work.  You can use the rank conjuction
to apply them to each element and assemble the results.

   14 */@(-i.)"0 i. 9
1 14 182 2184 24024 240240 2162160 17297280 121080960

Although if you need the whole sequence, it might be better to compute
it like this,

   1, */\ 14 - i. 8
1 14 182 2184 24024 240240 2162160 17297280 121080960

Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to