aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Hoekstra <codereport@outlook.com>2025-06-02 14:04:45 -0400
committerConor Hoekstra <codereport@outlook.com>2025-06-02 14:04:45 -0400
commit13622445005c809dd1081db91a33985f72f12f36 (patch)
tree6173f4b67023f36a85fe5316be3174bb25302d7a
parentb0159e77cc4e56da3a5a1c86d5769c652bcc887e (diff)
downloadperlweeklychallenge-club-13622445005c809dd1081db91a33985f72f12f36.tar.gz
perlweeklychallenge-club-13622445005c809dd1081db91a33985f72f12f36.tar.bz2
perlweeklychallenge-club-13622445005c809dd1081db91a33985f72f12f36.zip
:sparkles: Week 324 in BQN
-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