From 8a3d42da29bd69994551a5a72ea56d4d74fc0bf8 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 18:29:08 +0000 Subject: [PATCH] [Sync Iteration] 8th/bob/1 --- solutions/8th/bob/1/bob.8th | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 solutions/8th/bob/1/bob.8th diff --git a/solutions/8th/bob/1/bob.8th b/solutions/8th/bob/1/bob.8th new file mode 100644 index 0000000..b4f617c --- /dev/null +++ b/solutions/8th/bob/1/bob.8th @@ -0,0 +1,44 @@ +: is-question \ s -- b + 1 s:rsub "?" = +; + +: is-capitalized \ s -- b + s:uc s:cmp 0 = +; + +: is-letter \ n -- b + dup 65 90 n:between + swap 97 122 n:between or +; + +: contains-letter \ s -- b + false swap + ( nip is-letter if + drop true break + then + ) s:each +; + +: is-capitalized-word \ s -- b + contains-letter swap dup is-capitalized and +; + +: bob \ s -- s + dup s:trim s:len 0 = if + 2drop "Fine. Be that way!" cr + else + dup is-question if + dup is-capitalized-word if + drop "Calm down, I know what I'm doing!" cr + else + drop "Sure." cr + then + else + dup is-capitalized-word if + drop "Whoa, chill out!" cr + else + drop "Whatever." cr + then + then + then +;