aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-308/conor-hoekstra/ch-1.bqn11
-rw-r--r--challenge-308/conor-hoekstra/ch-2.bqn11
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-308/conor-hoekstra/ch-1.bqn b/challenge-308/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..2e986bd207
--- /dev/null
+++ b/challenge-308/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,11 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/308-1.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+
+CommonCount ← +´∊
+
+# Tests
+u.UnitTest (⟨"perl", "weekly", "challenge"⟩ CommonCount ⟨"raku", "weekly", "challenge"⟩) ≡ 2
+u.UnitTest (⟨"perl", "raku", "python"⟩ CommonCount ⟨"python", "java"⟩) ≡ 1
+u.UnitTest (⟨"guest", "contribution"⟩ CommonCount ⟨"fun", "weekly", "challenge"⟩) ≡ 0
diff --git a/challenge-308/conor-hoekstra/ch-2.bqn b/challenge-308/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..695c1b53f3
--- /dev/null
+++ b/challenge-308/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,11 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/308-2.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+
+Xor ← { ⊑𝕨⟨32⟩•bit._xor⟨𝕩⟩ } # TODO: has to be a better way to do this
+DecodeXor ← { Xor`𝕨∾𝕩 }
+
+# Tests
+u.UnitTest (1 DecodeXor ⟨1, 2, 3⟩) ≡ ⟨1, 0, 2, 1⟩
+u.UnitTest (4 DecodeXor ⟨6, 2, 7, 3⟩) ≡ ⟨4, 2, 0, 7, 4⟩