HaloO,

I know that the hot phase of the operator discussions are over.
But here's a little orthogonalizing idea from my side. The observation
is that * can be regarded as repeated addition: 5 * 3 == 5 + 5 + 5
and ** as repeated multiplication. Now imagine having a meta_postfix:<*>
that gives +* as multiplication (perhaps abbreviated as *) and ** as
(integer) exponentiation. We can then continue with replication as ~*
for strings and ,* for lists thus freeing x and xx as some generic
multiplication operators.

The meta * also is useful e.g. as (1,2) Z* 3 === (1,1,1),(2,2,2). Also
when we apply it to unary postfix as well: $x++* 3 === $x++.++.++ which
is useful when $x is of some class with overloaded ++ where the single
steps are important. The meta postfix * could also be stacked and tetration
falls out naturally as ***.

With + as the default case for meta_postfix:<*> we win the advantage that
we have +* and * as multiplication operators with the latter being a special
form of the former. But for Vectors +* would automatically yield the scalar
multiplication infix:<+*>:(Vector,Num) when infix:<+>:(Vector,Vector) is
defined as expected.


Regards, TSa.
-- 
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to