Hello all,
I get the impression that hyperoperators are finalized. Nevertheless,
here's an alternative way of hyperoperating on arrays. It uses
superscript numbers to indication index iteration. It allows terse
syntax for reversing arrays, getting the dot product, and even doing a
matrix multiplication.
A superscript after a variable indicates forward iteration, and a
superscript before indicates reverse iteration. The superscripts 1,2,3
correspond to multiple levels of for loops that encase the code, with
variables of i,j,k.
The following is flawed in many ways (collides with squaring and cubing
operations, pseudocode looks like C, it's totally untested) but you
might find it interesting to look at.
Derek Ross.
======
Unicode characters used:
¹ ¹
² ²
³ ³
# One-dimensional assignment
SYNTAX CODE EXPANSION (inside of nested for loop(s))
======= ==============
a¹ = b¹ a[i] = b[i]
a¹ = ¹b a[i] = b[-i]
¹a = b¹ a[-i] = b[i]
# Two-dimensional assignment
a¹² = b¹² a[i][j] = b[i][j]
¹a² = b¹² a[-i][j] = b[i][j]
¹²a = b¹² a[-i][-j] = b[i][j]
a¹² = ¹b² a[i][j] = b[-i][j]
¹a² = ¹²b a[-i][j] = b[-i][-j]
# 2-D assignment, swap and discard dimensions
a¹² = b²¹ a[i][j] = b[j][i]
a¹² = b¹¹ a[i][j] = b[i][i]
a²² = b¹¹ a[j][j] = b[i][i]
# Reverse an array
a¹ = ¹b
# Maximum element in array
max = a[0];
if(a¹ > max){max = a¹}
# Matrix transpose
a¹² = b²¹
# Dot (inner) product
p = 0;
p += a¹ * b¹;
# Outer product
p¹² = a¹ * b²;
# Matrix multiplication
p¹² = 0;
p¹² += a¹³ * b³²;
# Sums of rows
s¹ = 0;
s¹ += a¹²;
# Extract even indices
a¹ = b¹˟²
===
Derek Ross