aboutsummaryrefslogtreecommitdiff
path: root/challenge-330/conor-hoekstra/ch-1.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-330/conor-hoekstra/ch-1.bqn')
-rw-r--r--challenge-330/conor-hoekstra/ch-1.bqn14
1 files changed, 14 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"