5

In Kenneth Iverson’s A Programming Language the reduction operation op/ is defined as a foldl (left fold):

The ◌-reduction of a vector  is denoted by ◌/ and defined as
    z←◌/ ⟺ z = (⋯((₁ ◌ ₂) ◌ ₃) ◌ ⋯ ᵢ)

However in modern APLs, it is clearly a right fold (foldr)

      {⍺⍵}/'abcd'
┌→─────────┐
│a ┌→─────┐│
│  │b ┌→─┐││
│  │  │cd│││
│  │  └──┘││
│  └∊─────┘│
└∊∊────────┘

I wonder when this change has happened (and what was the motivation)?

Perhaps(?) defining ◌/v merely as v₁ ◌ v₂ ◌ ⋯ ◌ vₙ, which (given APL rules) would parse as foldr does make some sense. On the other hand, implementing efficient foldl is rather easier.

lelf
  • 237
  • 1
  • 8

1 Answers1

5

A Programming Language is from 1962.

The 1963 paper Programming Notation in Systems Design has the same definition.

The 1964 paper A Common Language for Hardware, Software, and Applications quotes the definition from A Programming Language.

At the very end of the 1966 paper Conventions Governing Order of Evaluation, Iverson wrote:

  1. In the definition

    F/x ≡ x1 F x2 F x3 F ... F x⍴x

    the right-to-left convention leads to a more useful definition for nonassociative functions F than does the left-to-right convention. For example, -/x denotes the alternating sum of the components of x , whereas in a left-to-right convention it would denote the first component minus the sum of the remaining components. Thus if d is the vector of decimal digits representing the number n , then the value of the expression 0=9|+/d determines the divisibility of n by 9 ; in the right-to-left convention, the similar expression 0=11|-/d determines divisibility by 11 .

Adám
  • 6,573
  • 20
  • 37