From 4939241a5dc7ce6020a6f72bb914d4f0a910564d Mon Sep 17 00:00:00 2001 From: HVukman Date: Sun, 23 Nov 2025 17:48:13 +0100 Subject: Create part1.retro --- challenge-348/hvukman/RETRO/Part1/part1.retro | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 challenge-348/hvukman/RETRO/Part1/part1.retro 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 + +~~~ -- cgit