-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial commit of task A/ABC_correlation
- Loading branch information
1 parent
f456c8f
commit 7d0e284
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env raku | ||
#u# https://www.rosettacode.org/wiki/ABC_correlation | ||
#c# 2024-09-08 <RC | ||
#m# MOAR: OK | ||
#j# JVM: BROKEN | ||
#n# I've elected to do 'or something' as specified in the task instructions. Rather than just feeding a few words in to check if there are equal counts of 'a', 'b', and 'c'; instead, reads in the words_alpha.txt word list and returns the words that have equal counts of 'a', 'b', and 'c', and, (to make things a little less verbose,) have more than one of each. | ||
|
||
my @res; | ||
|
||
@res.push: $_ for 'ref/words.txt'.IO.lines.hyper.grep({+(my \b = .comb.Bag)<a> > 1 and [==] b<a b c>}) X~ " True"; | ||
|
||
.say for @res; | ||
|
||
my $ref = q:to/END/; | ||
abboccato True | ||
back-to-back True | ||
bambocciade True | ||
beccabunga True | ||
blackback True | ||
black-backed True | ||
bombacaceous True | ||
brachiocubital True | ||
bric-a-brac True | ||
bric-a-brackery True | ||
buccolabial True | ||
cabbalistic True | ||
subbrachycephaly True | ||
subcarbonaceous True | ||
tobacco-abusing True | ||
tobacco-breathed True | ||
END | ||
|
||
use Test; | ||
is @res.join("\n"), chomp $ref; |