sub solutions-filter(@sols, &agg, Bool:D :$flip = False) {
my @aggregates = @sols.map({ agg($_) });
my %d;
%d{$_} += %d{$_} ?? %d{$_} !! 1 for @aggregates;
return @sols.grep({ %d{ agg($_) } == 1 }) if $flip;
return @sols.grep({ %d{ agg($_) } != 1 });
}
my @candidates = ((1..99) X (1..99)).grep({ $_[0] ≤ $_[1] });
my @ns = @candidates;
for 1..7 {
@ns = solutions-filter @ns, { $_[0] * $_[1] };
@ns = solutions-filter @ns, { $_[0] + $_[1] };
}
say solutions-filter(@ns, { $_[0] * $_[1] }, :flip); There are two things that a programming language needs to be acceptable:
- Be Python
- Be a language I have used recently
It's almost as if Python marks the pinnacle of programming language research which isn't the case at all. In fact, I daresay no language can since programming languages are a matter of compromises and trade-offs. A language's compromises and trade-offs you're willing to put off with might not be the same for another person. There's an interesting phenomenon I've observed in the Perl community (or at least the Raku for the most part) which seems to be rare in other places: Whenever a situation arises where Raku might not be the best candidate for, community members aren't afraid to consider/suggest/recommend other programming languages as viable options.
This is beyond comical.