diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2025-01-27 11:07:32 -0500 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2025-01-27 11:07:32 -0500 |
| commit | 75a270957f19df561b803588f7f465dc31106e33 (patch) | |
| tree | 3ed19732576916bd2046881a165bc5f89bc451bc | |
| parent | 906bb690f8e1d091ac358c4ac77818bf879144c8 (diff) | |
| download | perlweeklychallenge-club-75a270957f19df561b803588f7f465dc31106e33.tar.gz perlweeklychallenge-club-75a270957f19df561b803588f7f465dc31106e33.tar.bz2 perlweeklychallenge-club-75a270957f19df561b803588f7f465dc31106e33.zip | |
:sparkles: Week 306 in BQN
| -rw-r--r-- | challenge-306/conor-hoekstra/ch-1.bqn | 13 | ||||
| -rw-r--r-- | challenge-306/conor-hoekstra/ch-2.bqn | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-306/conor-hoekstra/ch-1.bqn b/challenge-306/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..f6bfefe208 --- /dev/null +++ b/challenge-306/conor-hoekstra/ch-1.bqn @@ -0,0 +1,13 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/306-1.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" + +OddSum ← { +´∾⥊¨(1+2×↕⌈2÷˜≠𝕩)↕¨<𝕩 } # Explicit +OddSum2 ← +´·∾·⥊¨((1+2×↕)·⌈2÷˜≠)↕¨< # Tacit + +# Tests +u.UnitTest (OddSum ⟨2,5,3,6,4⟩) ≡ 77 +u.UnitTest (OddSum ⟨1,3⟩) ≡ 4 +u.UnitTest (OddSum2 ⟨2,5,3,6,4⟩) ≡ 77 +u.UnitTest (OddSum2 ⟨1,3⟩) ≡ 4 diff --git a/challenge-306/conor-hoekstra/ch-2.bqn b/challenge-306/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..fc335e0e6e --- /dev/null +++ b/challenge-306/conor-hoekstra/ch-2.bqn @@ -0,0 +1,10 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/306-2.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" + +LastElement ← { 1≥≠𝕩 ? ⊑𝕩∾0 ; 𝕊(2↓s)∾≠´◶⟨⟩‿(⋈∘-´)2↑s ← ∨𝕩 } + +# Tests +u.UnitTest (LastElement ⟨3, 8, 5, 2, 9, 2⟩) ≡ 1 +u.UnitTest (LastElement ⟨3, 2, 5⟩) ≡ 0 |
