aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-07-15 11:00:34 +0100
committerGitHub <noreply@github.com>2025-07-15 11:00:34 +0100
commitf0f9cb0868604d1802c73fa4963fb01c80a41ec2 (patch)
tree3f81a781e69544e34f284a05db910206febdad39
parent4defe3499e32a2ffd9871e548763285802f4b329 (diff)
parentcf76ee76d748edf76ca499258ceb0c756a2b5d42 (diff)
downloadperlweeklychallenge-club-f0f9cb0868604d1802c73fa4963fb01c80a41ec2.tar.gz
perlweeklychallenge-club-f0f9cb0868604d1802c73fa4963fb01c80a41ec2.tar.bz2
perlweeklychallenge-club-f0f9cb0868604d1802c73fa4963fb01c80a41ec2.zip
Merge pull request #12351 from codereport/master
:sparkles: Week 330 in BQN
-rw-r--r--challenge-330/conor-hoekstra/ch-1.bqn14
-rw-r--r--challenge-330/conor-hoekstra/ch-2.bqn16
2 files changed, 30 insertions, 0 deletions
diff --git a/challenge-330/conor-hoekstra/ch-1.bqn b/challenge-330/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..5ad557215e
--- /dev/null
+++ b/challenge-330/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,14 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/330-1.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+s ⇐ •Import "/home/cph/bqn-code/lib/string.bqn"
+
+Bad ← { ∨´s.IsDigit¨𝕩 }
+Fix ← { 𝕩/˜¬(↕≠𝕩)∊¯1‿0+⊑/s.IsDigit¨𝕩 }
+ClearDigits ← { Fix•_while_ Bad 𝕩 }
+
+# Tests
+u.UnitTest (ClearDigits "cab12") ≡ "c"
+u.UnitTest (ClearDigits "xy99") ≡ ""
+u.UnitTest (ClearDigits "pa1erl") ≡ "perl"
diff --git a/challenge-330/conor-hoekstra/ch-2.bqn b/challenge-330/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..6ce167b686
--- /dev/null
+++ b/challenge-330/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,16 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/330-2.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+s ⇐ •Import "/home/cph/bqn-code/lib/string.bqn"
+
+TitleCapital ← { s.Unwords (2<≠)◶⊢‿(s.Upper⌾⊑)¨ s.Words s.Lower 𝕩 } # Explicit
+TitleCapital2 ← s.Unwords·(2<≠)◶⊢‿(s.Upper⌾⊑)¨·s.Words s.Lower # Tacit
+
+# Tests
+u.UnitTest (TitleCapital "PERL IS gREAT") ≡ "Perl is Great"
+u.UnitTest (TitleCapital "THE weekly challenge") ≡ "The Weekly Challenge"
+u.UnitTest (TitleCapital "YoU ARE A stAR") ≡ "You Are a Star"
+u.UnitTest (TitleCapital2 "PERL IS gREAT") ≡ "Perl is Great"
+u.UnitTest (TitleCapital2 "THE weekly challenge") ≡ "The Weekly Challenge"
+u.UnitTest (TitleCapital2 "YoU ARE A stAR") ≡ "You Are a Star"