diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2025-10-20 14:11:54 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2025-10-20 14:11:54 -0400 |
| commit | fda609a8e8806c401568d5a53918e963a2c8c53f (patch) | |
| tree | 5e62039c000581822b138151174a086fe974f153 | |
| parent | c9375e027adb21f7c8a3b419d423d8c2f7c202d8 (diff) | |
| download | perlweeklychallenge-club-fda609a8e8806c401568d5a53918e963a2c8c53f.tar.gz perlweeklychallenge-club-fda609a8e8806c401568d5a53918e963a2c8c53f.tar.bz2 perlweeklychallenge-club-fda609a8e8806c401568d5a53918e963a2c8c53f.zip | |
:sparkles: Week 344 in BQN
| -rw-r--r-- | challenge-344/conor-hoekstra/ch-1.bqn | 15 | ||||
| -rw-r--r-- | challenge-344/conor-hoekstra/ch-2.bqn | 14 |
2 files changed, 29 insertions, 0 deletions
diff --git a/challenge-344/conor-hoekstra/ch-1.bqn b/challenge-344/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..89d9c12c46 --- /dev/null +++ b/challenge-344/conor-hoekstra/ch-1.bqn @@ -0,0 +1,15 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/344-1.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" +b ⇐ •Import "/home/cph/bqn-code/lib/binary.bqn" + +FromDigits ← { +´𝕩×⌽10⋆↕≠𝕩 } +ArrayFormCompute ← b.Digits+⟜FromDigits + +# Tests +u.UnitTest ( 12 ArrayFormCompute ⟨1, 2, 3, 4⟩) ≡ ⟨1, 2, 4, 6⟩ +u.UnitTest ( 181 ArrayFormCompute ⟨2, 7, 4⟩) ≡ ⟨4, 5, 5⟩ +u.UnitTest ( 1 ArrayFormCompute ⟨9, 9, 9⟩) ≡ ⟨1, 0, 0, 0⟩ +u.UnitTest (9999 ArrayFormCompute ⟨1, 0, 0, 0, 0⟩) ≡ ⟨1, 9, 9, 9, 9⟩ +u.UnitTest (1000 ArrayFormCompute ⟨0⟩) ≡ ⟨1, 0, 0, 0⟩ diff --git a/challenge-344/conor-hoekstra/ch-2.bqn b/challenge-344/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..f104129e4f --- /dev/null +++ b/challenge-344/conor-hoekstra/ch-2.bqn @@ -0,0 +1,14 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/344-2.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" +fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn" + +ArrayFormation ← { ∨´𝕨⊸≡∘∾˘fn.Permutations𝕩 } + +# Tests +u.UnitTest ( ⟨1, 2, 3, 4⟩ ArrayFormation ⟨⟨2,3⟩, ⟨1⟩, ⟨4⟩⟩) ≡ 1 +u.UnitTest ( ⟨1, 2, 3, 4⟩ ArrayFormation ⟨⟨1,3⟩, ⟨2,4⟩⟩) ≡ 0 +u.UnitTest (⟨5, 8, 2, 9, 1⟩ ArrayFormation ⟨⟨9,1⟩, ⟨5,8⟩, ⟨2⟩⟩) ≡ 1 +u.UnitTest ( ⟨1, 2, 3⟩ ArrayFormation ⟨⟨1⟩, ⟨3⟩⟩) ≡ 0 +u.UnitTest ( ⟨7, 4, 6⟩ ArrayFormation ⟨⟨7,4,6⟩⟩) ≡ 1 |
