[comp.lang.apl] Experiments with I.P. SHARP APL/PC

reiterc@lafcol.UUCP (Reiter Clifford A) (04/19/88)

Here are some "light" APL expressions which highlight some of the
extended features of Sharp APL/PC which I have found useful.  (I think
these are extensions.)  I thought some of the new Sharp APL users would
like to experiment with some of these.

COMPLEX NUMBERS
------- -------

(-1)*.5
1o(-1)oo1
A is ((-8)+ 4 4 rho iota 16)*.5   comment: on the union keyboard quaddiv
                                  is alt =,alt back sp,alt l
                                   and quadPP uses lower case P's
quadPP is 5                                        ----- ----
quaddiv A
A+.x quaddiv A
quadPP is 10

GCD
---

I is iota 8
I jot.or I
(*1)or 1.5x*1
(*1)or o1              comment: e or pi

(go ahead, try it with complex numbers)

ENCLOSED ARRAYS
-------- ------

quadPS is 0,0,(-2),(-2)  comment: the negatives are needed and quadPS
uses
                                  lower case P and S
                                  ----- ----


A is <3 4 rho iota 12
B is <2 2 rho 1 0 0
A,B
4 5 rho A,B
<<<<<<<<<'me'          comment: for the introverted

EXTENDING AN AXIS OF LENGTH 1
--------- -- ---- -- ------ -

A is ?3 3 rho 10
V is ? 3 rho 10
B is 1 3 rho V

A+.xV
A+.xB 
 
How is V different from >,<V ?

Straight forward frequency counts of the occurrences of the elements of
W
in a data vector A is given by:

FREQ is +/[1] A jot.= W

Faster by 30% (roughly) is:

FREQ is A+.=>,<W      comment: isn't it pretty

Faster is:

FREQ is +/ W jot.= A

Faster still is the suggestions about mode made some weeks ago.


Clifford Reiter               reiterc@lafcol.UUCP
Mathematics Department 
Lafayette College