Matrix multiplication: Difference between revisions

→‎{{header|Raku}}: last version is not really more concise, rather more functional. + style code tweak
m (→‎{{header|Wren}}: Minor tidy)
(→‎{{header|Raku}}: last version is not really more concise, rather more functional. + style code tweak)
Line 5,584:
{{works with|Rakudo|2022.07-3}}
 
Here is an evena more concisefunctional version, expressing the product of two matrices as the cross dot product of the first matrix with the transpose of the second :
 
<syntaxhighlight lang="raku" line>sub infix:<×·>( { [+] @A,^a Z* @B)^b {}
sub infix:<×>(@A, @B) {
cross(@A, ([Z] @B), with => { &[+·] @^a Z* @^b })
.rotor(@B);
}</syntaxhighlight>
1,934

edits