Replicate each, anyone?

  • Authors:
  • J. Philip Benkard

  • Affiliations:
  • Staff Programmer, Module Manufacturing Engineering, International Business Machines Corporation, Dept 262/Blda 416, P. O. Box 950, Poughkeepsie, New York

  • Venue:
  • APL '87 Proceedings of the international conference on APL: APL in transition
  • Year:
  • 1987

Quantified Score

Hi-index 0.00

Visualization

Abstract

In both the IPSA and APL2/NARS extensions of APL, the SLASH symbol always represents an operator. Some new users of APL2, having been taught in the past that SLASH is an ambiguous symbol which is a dyadic function when it immediately follows data, find that the result when SLASH occurs between data and another operator is incompatible with that interpretation. The situation did not arise in APL1 because derived functions could not be operands. The classification of SLASH as an operator can be traced to the description given in the book. A Programming Language, from which APL ultimately derives. It was done so that the closely related MASK operation could be specified with the same symbol. In this paper the syntactic differences between dyadic functions and aonadic operators with data operands are explicated using the APL2 concept of syntactic binding. Two straightforward language extensions are considered based on the notions of a depth property, which APL2 shares with STSC's NARS, and pairwise evaluation, which derives from syntactic binding. Together they allow either dyadic functions or monadic operators with data operands to be executed in three structural contexts, which, in the cases of REPLICATE and EXPAND, can be loosely described as the same mask for each of several arrays, a separate mask for each array, and the same array for each of several masks.