hyperoperators: pointless musings

2005-11-24 Thread Derek Ross

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² = ¹²ba[-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


Junctions & Set Theory

2003-08-01 Thread Derek Ross
Hello,

Do junctions have a direct representation as predicate logic statements? 
 In particular, do the following logic statements correspond directly 
to the following perl6 junctions:

LOGIC   PERL6 JUNCTION (DESCRIP)
=   
(forall x)(x is true)   all  (conjunction)
(exists x)(x is true)   any  (disjunction)
(forall x)(x is false)  none (injunction)
(exists x)(x is false)  one  (abjunction)
I don't have a really clear understanding of junctions (which is why I'm 
posting this message, to try to clarify junctions in relation to a topic 
I'm more familiar with), but it seems that the fourth type of junction, 
"one" is inconsistent with the logic definition.

Maybe "one" should be named "one_isnt", or the logic statement should 
become (exists a single x)(x is true).  Either way, maybe another 
junction is needed!

Derek Ross.