Shoelace formula for polygonal area: Difference between revisions
m
→{{header|Perl 6}}: minor simplification
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add a Perl 6 example) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: minor simplification) |
||
Line 47:
<lang perl6>sub area-by-shoelace(@p) {
▲ (^@p.end).map({@p[$_;0] * @p[$_+1;1] - @p[$_;1] * @p[$_+1;0]}).sum.abs / 2
}
|