[comp.lang.apl] APL2: "/" as Function

dave@visual1.jhuapl.edu (Dave Weintraub) (04/19/91)

Comment on Greg Jaxon's comment during the ongoing discussion on sorting:

SHARE requirement 90404: Negative Left Argument for Partition:

The Partition primitive function should be modified to so that 
the left argument will accept negative (integer) values,
with no other change to the defintion.

This would mean that:

       1  0 _1  0  1  Partition 'ABCDE'	
or:
      _1  0 _1  0  1  Partition 'ABCDE'

would yield:

'AC'  'E'

That is, the elements corresponding to zeroes are deleted,
and a new element of the result is started whenever
an element of the left argument is greater than the preceding element.


Among other things, this would allow partition to be used as
a replacement for (non-Replicate) Compress.  That is:

      Enlist (-B) Partition V

would be equivalent to:

      B/V

for simple V.  This would mean that a primitive-based
Compress function, useable with, for example, Each,
would be available.

Idiom recognition could allow this to be efficient.