aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Hoekstra <codereport@outlook.com>2025-07-26 21:50:25 -0400
committerConor Hoekstra <codereport@outlook.com>2025-07-26 21:50:25 -0400
commit1abe22e01982005182c64a022fd589c6c508c6e2 (patch)
tree8464b1773a5e306e77a85baa5dc8ca1e8e91de22
parent1ff2c9796a511d63231d3757acb27e4046a91fb2 (diff)
downloadperlweeklychallenge-club-1abe22e01982005182c64a022fd589c6c508c6e2.tar.gz
perlweeklychallenge-club-1abe22e01982005182c64a022fd589c6c508c6e2.tar.bz2
perlweeklychallenge-club-1abe22e01982005182c64a022fd589c6c508c6e2.zip
:sparkles: Week 331 in BQN
-rw-r--r--challenge-331/conor-hoekstra/ch-1.bqn12
-rw-r--r--challenge-331/conor-hoekstra/ch-2.bqn16
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-331/conor-hoekstra/ch-1.bqn b/challenge-331/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..09610d2384
--- /dev/null
+++ b/challenge-331/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,12 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/331-1.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+s ⇐ •Import "/home/cph/bqn-code/lib/string.bqn"
+
+LastWordLength ← ≠·⊢´s.Words
+
+# Tests
+u.UnitTest (LastWordLength "The Weekly Challenge") ≡ 9
+u.UnitTest (LastWordLength " Hello World ") ≡ 5
+u.UnitTest (LastWordLength "Let's begin the fun") ≡ 3
diff --git a/challenge-331/conor-hoekstra/ch-2.bqn b/challenge-331/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..b78af76790
--- /dev/null
+++ b/challenge-331/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,16 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/331-2.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn"
+
+Dup ← 1=·⌈´⊒
+MatchAndDup ← ≡∧Dup∘⊢
+Swappable ← (≠/⊣)((4=≠∘∾)∧≡)(⌽≠/⊢)
+BuddyStrings ← Swappable ∨ MatchAndDup
+
+# Tests
+u.UnitTest ("fuck" BuddyStrings "fcuk") ≡ 1
+u.UnitTest ("love" BuddyStrings "love") ≡ 0
+u.UnitTest ("fodo" BuddyStrings "food") ≡ 1
+u.UnitTest ("feed" BuddyStrings "feed") ≡ 1