On Thu, Dec 22, 2011 at 5:54 AM, Henry Rich <henryhr...@nc.rr.com> wrote:
> Note that
>
> c}b,:a
>
> does indeed compute b,:a.  But if it's used in the precise form
>
> result =: c}b,:a
>
> the computation is avoided.
>
>    b =: 1e6$4
>    a =: 1e6$4
>    c=: ? 1e6$ 2
>    ts 'c}b,:a'
> 0.0401299 2.09725e7
>    ts 'q =: c}b,:a'
> 0.0112949 4.19558e6
>
> There are other special cases; see the Special Code page.

Especially the "in-place" case where items of b or a are altered in-place.
Note that timespacex is defined in the stdlib in J7.

   timespacex ' c}b,:a'
0.0229656 4.19451e7
   timespacex 'q=: c}b,:a'
0.00915218 8.39091e6
   timespacex 'b=: c}b,:a'
0.00612322 2304
   timespacex 'b=: c}b,:a'
0.00612322 2304
   timespacex 'b=: c}a,:b'
0.00615121 2304
   timespacex 'a=: c}b,:a'
0.00612789 2304
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to