diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2025-09-01 16:57:24 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2025-09-01 16:57:24 -0400 |
| commit | cda29f36a8a42a7dad3b67cbad7f965113b0db1c (patch) | |
| tree | de214b3b4a27cb0a7603323fe9726b0d1364e979 | |
| parent | 598b053a884d608580077ec5985f8446f5a9a836 (diff) | |
| download | perlweeklychallenge-club-cda29f36a8a42a7dad3b67cbad7f965113b0db1c.tar.gz perlweeklychallenge-club-cda29f36a8a42a7dad3b67cbad7f965113b0db1c.tar.bz2 perlweeklychallenge-club-cda29f36a8a42a7dad3b67cbad7f965113b0db1c.zip | |
:sparkles: Week 337 in BQN
| -rw-r--r-- | challenge-337/conor-hoekstra/ch-1.bqn | 13 | ||||
| -rw-r--r-- | challenge-337/conor-hoekstra/ch-2.bqn | 16 |
2 files changed, 29 insertions, 0 deletions
diff --git a/challenge-337/conor-hoekstra/ch-1.bqn b/challenge-337/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..3072130e2f --- /dev/null +++ b/challenge-337/conor-hoekstra/ch-1.bqn @@ -0,0 +1,13 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/337-1.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" + +SmallerThanCurrent ← ¯1+·+´˘≥⌜˜ + +# Tests +u.UnitTest (SmallerThanCurrent ⟨6, 5, 4, 8⟩) ≡ ⟨2, 1, 0, 3⟩ +u.UnitTest (SmallerThanCurrent ⟨7, 7, 7, 7⟩) ≡ ⟨3, 3, 3, 3⟩ +u.UnitTest (SmallerThanCurrent ⟨5, 4, 3, 2, 1⟩) ≡ ⟨4, 3, 2, 1, 0⟩ +u.UnitTest (SmallerThanCurrent ⟨¯1, 0, 3, ¯2, 1⟩) ≡ ⟨1, 2, 4, 0, 3⟩ +u.UnitTest (SmallerThanCurrent ⟨0, 1, 1, 2, 0⟩) ≡ ⟨1, 3, 3, 4, 1⟩ diff --git a/challenge-337/conor-hoekstra/ch-2.bqn b/challenge-337/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..b0e2ef0014 --- /dev/null +++ b/challenge-337/conor-hoekstra/ch-2.bqn @@ -0,0 +1,16 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/337-2.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" + +Row ← { 1⊸+⌾(𝕨⊸⊏)𝕩 } +Col ← ⍉Row⟜⍉ +RowCol ← { r‿c𝕊𝕩: r Row c Col 𝕩 } +OddMatrix ← { +´2|⥊(𝕨⥊0) RowCol´ 𝕩 } + +# Tests +u.UnitTest (2‿3 OddMatrix ⟨⟨0,1⟩,⟨1,1⟩⟩) ≡ 6 +u.UnitTest (2‿2 OddMatrix ⟨⟨1,1⟩,⟨0,0⟩⟩) ≡ 0 +u.UnitTest (3‿3 OddMatrix ⟨⟨0,0⟩,⟨1,2⟩,⟨2,1⟩⟩) ≡ 0 +u.UnitTest (1‿5 OddMatrix ⟨⟨0,2⟩,⟨0,4⟩⟩) ≡ 2 +u.UnitTest (4‿2 OddMatrix ⟨⟨1,0⟩,⟨3,1⟩,⟨2,0⟩,⟨0,1⟩⟩) ≡ 8 |
