Set consolidation: Difference between revisions

→‎{{header|Perl 6}}: use empty list for degenerate case rather than single item, use pronouns instead of x and y
(→‎{{header|Perl 6}}: use more compact conditional)
(→‎{{header|Perl 6}}: use empty list for degenerate case rather than single item, use pronouns instead of x and y)
Line 239:
=={{header|Perl 6}}==
{{works with|niecza|2012-06}}
<lang perl6>multi consolidate(Set $x) { $x() }
multi consolidate(Set $x\this is copy, *@ythose) {
gather {
for consolidate |@ythose -> $y\that {
if +($xthis$ythat) { $xthis ∪= $ythat }
else { take $ythat }
}
take $xthis;
}
}
Anonymous user