diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-11-23 17:48:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-23 17:48:13 +0100 |
| commit | 4939241a5dc7ce6020a6f72bb914d4f0a910564d (patch) | |
| tree | 07c0e8d7b66106a8db989ccfb02a0b1e637a0830 | |
| parent | 7ce73ea4778f4f3803e84dd3a09b721e2c72dc4e (diff) | |
| download | perlweeklychallenge-club-4939241a5dc7ce6020a6f72bb914d4f0a910564d.tar.gz perlweeklychallenge-club-4939241a5dc7ce6020a6f72bb914d4f0a910564d.tar.bz2 perlweeklychallenge-club-4939241a5dc7ce6020a6f72bb914d4f0a910564d.zip | |
Create part1.retro
| -rw-r--r-- | challenge-348/hvukman/RETRO/Part1/part1.retro | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/challenge-348/hvukman/RETRO/Part1/part1.retro b/challenge-348/hvukman/RETRO/Part1/part1.retro new file mode 100644 index 0000000000..cb10b690ee --- /dev/null +++ b/challenge-348/hvukman/RETRO/Part1/part1.retro @@ -0,0 +1,13 @@ +splitat calculate half length of string +consonants filters non vowels from string +stringalike checks if filtered strings are not zero and if so, compares the lengths of the strings +print -1 if true; 0 otherwise +~~~ + +:splitat dup s:length #2 / ; +:consonants [ c:vowel? ] s:filter ; +:stringalike dup-pair [ n:-zero? ] bi@ and [ eq? n:put nl ] [ #0 n:put nl ] choose ; +:stringsplit [ splitat s:right consonants ] [ splitat s:left consonants ] bi [ s:length ] bi@ stringalike ; +{ 'textbook 'book 'AbCdEfGh 'rhythmmyth 'UmpireeAudio } [ dup s:put ':_ s:put stringsplit ] a:for-each + +~~~ |
