aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-324/conor-hoekstra/ch-1.bqn11
-rw-r--r--challenge-324/conor-hoekstra/ch-2.bqn14
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-324/conor-hoekstra/ch-1.bqn b/challenge-324/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..4d15712906
--- /dev/null
+++ b/challenge-324/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,11 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/324-1.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+
+Make2dArray ← ⥊
+
+# Tests
+u.UnitTest (2‿2 Make2dArray 1‿2‿3‿4) ≡ >⟨⟨1,2⟩,⟨3,4⟩⟩
+u.UnitTest (1‿3 Make2dArray 1‿2‿3) ≡ >⟨⟨1,2,3⟩⟩
+u.UnitTest (4‿1 Make2dArray 1‿2‿3‿4) ≡ >⟨⟨1⟩,⟨2⟩,⟨3⟩,⟨4⟩⟩
diff --git a/challenge-324/conor-hoekstra/ch-2.bqn b/challenge-324/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..4ebf54eecf
--- /dev/null
+++ b/challenge-324/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,14 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/324-2.bqn
+
+u ⇐ •Import "/home/cph/bqn-test/test.bqn"
+fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn"
+
+Xor ← {⊑𝕨⟨32⟩•bit._xor⟨𝕩⟩} # TODO has to be a better way to do this
+
+TotalXor ← +´·Xor´¨1↓fn.PowerSet
+
+# Tests
+u.UnitTest (TotalXor 1‿3) ≡ 6
+u.UnitTest (TotalXor 5‿1‿6) ≡ 28
+u.UnitTest (TotalXor 3‿4‿5‿6‿7‿8) ≡ 480