>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary

Appendix B. Special Code

Many primitives contain special code for certain arguments to effect time and/or space savings not available to general arguments. Moreover, some phrases are "recognized" and are supported by special code. For example, the dyad of the hook ($,) is exactly the reshape of APL (denoted by r); its implementation avoids actually ravelling the right argument, and in so doing saves both time and space:

   ts=: 6!:2 , 7!:2@]
   x=: 11 13 17 19 23
   y=: 29 7 23 11 19$'sesquipedalian'

   (x ($,) y) -: x $, y
1

   ts 'x ($,) y'
0.00773981 2.09818e6
   ts 'x $, y'
0.0170125 3.14662e6
Instances of such special code are listed below:
                        
= dyad word-parallel operation on Boolean arguments for the following verbs:
= < <. <: > >. >: +. +: * *. *: ^ ~: | !
<.@f both avoids non-integer intermediate results on extended precision integers
>.@f both avoids non-integer intermediate results on extended precision integers
+ dyad also * and - ; on Windows, assembly code for integer arguments for the vector-vector, vector-scalar, and scalar-vector cases
^ dyad x^y works by repeated multiplication if x is real and y is integral
m&|@^ dyad avoids exponentiation for extended precision arguments
m&|@(n&^) monad avoids exponentiation for extended precision arguments
+/ .* dyad special code
-/ .* monad special code in general; special code for square matrices; special code for arrays of 2-by-2 matrices; see the J 4.05 release notes
$, dyad also ($,)"r ; also {, {., }., e., ; avoids ravel; see the J 4.06 release notes
[;.0 both also ] ; special code for vector or matrix right arguments; see the J 5.01 release notes
f;.1 both also f;._1 f;.2 f;._2 ; avoids building argument cells for several verbs: < $ , # [ ] {. {: <@}. <@}: ; also <&}. <@:}. etc.; special code for sparse Boolean left argument; see the J 4.05 release notes
f;.3 both also f;._3 ; special code for matrix right arguments
# dyad special code for Boolean left arguments
# i.@# monad also (# i.&#) , etc.; avoids i. on Boolean arguments; see the J 4.06 release notes
#: i.@(*/) monad also (#: i.&(*/)) , etc.; special code for non-negative integer vectors; see the J 4.05 release notes
=/ monad also < <: > >: +. +: * *. *: ~: ; word-parallel operations on Boolean arguments
+/ monad also * and - ; on Windows, assembly code for integer arguments
,/ monad also ,. ,.&.> ; ; linear time; see the J 4.05 release notes
m b./ both special code for bitwise Boolean functions; see the J 5.01 release notes
f/@, monad also f/@:, f/&, f/&:, ; avoids ravel; see the J 4.05 release notes
#/. dyad avoids building argument cells
/: both also \: ; special code for several data types; special code for arguments with 5 items or less; see the J 4.05 release notes
/: dyad special code when the left and right arguments are the same boolean, literal, integer, or floating point vector; also for /:"1 when the left and right arguments are the same boolean, literal, integer, or floating point arrays; also for \: ; see the J 5.01 release notes
/:~ monad special code for boolean, literal, integer, or floating point vectors; also for /:~"1 and /:"1~ ; also for \: ; see the J 5.01 release notes
=/\ monad also +. *. ~: ; word-parallel operations on Boolean arguments
+/\ monad also * and - ; on Windows, assembly code for integer arguments
[\ dyad also ] and , ; see the J 5.01 release notes
2 f/\y dyad also 2 f~/\y ; special code for atomic f and vector y ; see the J 4.06 release notes
m b./\ monad special code for bitwise Boolean functions; see the J 5.01 release notes
=/\. monad also < <: > >: +. +: *. *: ~: ; word-parallel operations on Boolean arguments
+/\. monad also * and - ; on Windows, assembly code for integer arguments
m b./\. monad special code for bitwise Boolean functions; see the J 5.01 release notes
{ dyad special code for right arguments of several data types; special code for integer left arguments; special code for indexing first two axes
<"1@[ { ] dyad avoids <"1 if left argument is integer array
a=: c}x,y,:z - avoids catenation and lamination; in-place if c is Boolean and a is x or y ; see the J 4.05 release notes
y=: x i}y - in-place
f"r both numerous verbs have integrated rank support:
= < <. <: > >. >: + +. +: * *. *: - -: % ^ ~: | |. |: $ , ,. ,: # ! [ ] { {. {: }. }: / /: \ \. \: b. e. i. i: o. p. p:
f0`...`fn@.v"0 monad special code if f0 , ... , fn are atomic; see the J 5.02 release notes
i.&1@:< dyad special code for Boolean, integer, floating point, or literal vectors or scalars, for the following functions, where comp is one of = ~: < <: >: > (= and ~: only for literal). See the J 5.01 release notes.
i.&0@:comp      comp i. 0:
i.&1@:comp comp i. 1:
i:&0@:comp comp i: 0:
i:&1@:comp comp i: 1:
  +/@:comp [: +/ comp
? monad also ?. ; special code if argument is identically 2
? dyad also ?. ; special code if left argument is much smaller than right argument
E. monad special code for Boolean and literal vector arguments
i. monad also i: ; special case for length-1 arguments
i. dyad also e. and i: ; special code for several data types; special code for i.!.0 ; special code for the monad i.~ or x i. x ; special code for arguments with many identical columns (see the J 4.05 release notes)



>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary