Matrix multiplication in FP
def MM = (applyall applyall IP) . (applyall distl) . distr . [1,
trans.2]
where
def IP = (/+) . (applyall mul) . trans
( e is empty sequence, # is buttom)
trans:x == x = < e , .. e > -> e;
x =
<x1,..xn> -> <y1,..ym>; #
where
xi = <xi1,...xim> and yj = <x1j,..xnj>
distl:x == x = <y,e> -> e;
x =
<y,<z1,..zn>> -> <<y,z1>,...<y,zn>>; #
distr:x == x = <y,e> -> e;
x =
<<y1,..yn>,z> -> <<y1,z>,...<yn,z>>; #
example
trans:<<1,2,3>, <4,5,6>> =
<<1,4>,<2,5>,<3,6>>
distl:<sq,<1,2,3>> =
<<sq,1>,<sq,2>,<sq,3>>
distr:<<single,double,triple>,10> =
<<single,10>,<double,10>,<triple,10>>