From 6f0d16f05f2773a17829abb2db30dff2c2f73444 Mon Sep 17 00:00:00 2001 From: Mohammad Sajid Anwar Date: Thu, 31 Jul 2025 11:32:35 +0100 Subject: - Added solutions by Conor Hoekstra. - Added solutions by Lukas Mai. - Added solutions by Peter Meszaros. - Added solutions by Peter Campbell Smith. - Added solutions by Andrew Shitov. - Added solutions by David Ferrone. - Added solutions by E. Choroba. - Added solutions by Jaldhar H. Vyas. - Added solutions by Bob Lied. - Added solutions by Mark Anderson. - Added solutions by W. Luis Mochan. - Added solutions by Feng Chang. - Added solutions by Arne Sommer. - Added solutions by Simon Proctor. - Added solutions by HVukamn. - Added solutions by Benjamin Andre. - Added solutions by PokGoPun. - Added solutions by Magnus Markling. - Added solutions by Roger Bell_West. - Added solutions by Athanasius. - Added solutions by Robbie Hatley. - Added solutions by Packy Anderson. - Added solutions by Ali Moradi. - Added solutions by Thomas Kohler. --- challenge-323/conor-hoekstra/bqn/ch-1.bqn | 11 +++++++++++ challenge-323/conor-hoekstra/bqn/ch-2.bqn | 21 +++++++++++++++++++++ challenge-323/conor-hoekstra/ch-1.bqn | 11 ----------- challenge-323/conor-hoekstra/ch-2.bqn | 21 --------------------- 4 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 challenge-323/conor-hoekstra/bqn/ch-1.bqn create mode 100644 challenge-323/conor-hoekstra/bqn/ch-2.bqn delete mode 100644 challenge-323/conor-hoekstra/ch-1.bqn delete mode 100644 challenge-323/conor-hoekstra/ch-2.bqn (limited to 'challenge-323') diff --git a/challenge-323/conor-hoekstra/bqn/ch-1.bqn b/challenge-323/conor-hoekstra/bqn/ch-1.bqn new file mode 100644 index 0000000000..92b237f6e6 --- /dev/null +++ b/challenge-323/conor-hoekstra/bqn/ch-1.bqn @@ -0,0 +1,11 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/323-1.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" + +IncrementDecrement ← +´·-˝"+-"=⌜⊑∘∧¨ + +# Tests +u.UnitTest (IncrementDecrement ⟨"--x", "x++", "x++"⟩) ≡ 1 +u.UnitTest (IncrementDecrement ⟨"x++", "++x", "x++"⟩) ≡ 3 +u.UnitTest (IncrementDecrement ⟨"x++", "++x", "--x", "x--"⟩) ≡ 0 diff --git a/challenge-323/conor-hoekstra/bqn/ch-2.bqn b/challenge-323/conor-hoekstra/bqn/ch-2.bqn new file mode 100644 index 0000000000..ce480bc8b6 --- /dev/null +++ b/challenge-323/conor-hoekstra/bqn/ch-2.bqn @@ -0,0 +1,21 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/323-2.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" +fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn" + +TaxAmount ← { + b ← fn.Deltas 0∾𝕨⌊⊑¨𝕩 # brackets + t ← 100÷˜⊢´¨𝕩 # tax rates + +´b×t +} + +TaxAmount2 ← +´(100÷˜⊢´¨)∘⊢×(fn.Deltas 0∾⌊⟜⊑¨) + +# Tests +u.UnitTest (10 TaxAmount ⟨3‿50, 7‿10, 12‿25⟩) ≡ 2.65 +u.UnitTest ( 2 TaxAmount ⟨1‿0, 4‿25, 5‿50⟩) ≡ 0.25 +u.UnitTest ( 0 TaxAmount ⟨2‿50⟩) ≡ 0 +u.UnitTest (10 TaxAmount2 ⟨3‿50, 7‿10, 12‿25⟩) ≡ 2.65 +u.UnitTest ( 2 TaxAmount2 ⟨1‿0, 4‿25, 5‿50⟩) ≡ 0.25 +u.UnitTest ( 0 TaxAmount2 ⟨2‿50⟩) ≡ 0 diff --git a/challenge-323/conor-hoekstra/ch-1.bqn b/challenge-323/conor-hoekstra/ch-1.bqn deleted file mode 100644 index 92b237f6e6..0000000000 --- a/challenge-323/conor-hoekstra/ch-1.bqn +++ /dev/null @@ -1,11 +0,0 @@ -# For up to date code: -# https://github.com/codereport/bqn-code/blob/main/pwc/323-1.bqn - -u ⇐ •Import "/home/cph/bqn-test/test.bqn" - -IncrementDecrement ← +´·-˝"+-"=⌜⊑∘∧¨ - -# Tests -u.UnitTest (IncrementDecrement ⟨"--x", "x++", "x++"⟩) ≡ 1 -u.UnitTest (IncrementDecrement ⟨"x++", "++x", "x++"⟩) ≡ 3 -u.UnitTest (IncrementDecrement ⟨"x++", "++x", "--x", "x--"⟩) ≡ 0 diff --git a/challenge-323/conor-hoekstra/ch-2.bqn b/challenge-323/conor-hoekstra/ch-2.bqn deleted file mode 100644 index ce480bc8b6..0000000000 --- a/challenge-323/conor-hoekstra/ch-2.bqn +++ /dev/null @@ -1,21 +0,0 @@ -# For up to date code: -# https://github.com/codereport/bqn-code/blob/main/pwc/323-2.bqn - -u ⇐ •Import "/home/cph/bqn-test/test.bqn" -fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn" - -TaxAmount ← { - b ← fn.Deltas 0∾𝕨⌊⊑¨𝕩 # brackets - t ← 100÷˜⊢´¨𝕩 # tax rates - +´b×t -} - -TaxAmount2 ← +´(100÷˜⊢´¨)∘⊢×(fn.Deltas 0∾⌊⟜⊑¨) - -# Tests -u.UnitTest (10 TaxAmount ⟨3‿50, 7‿10, 12‿25⟩) ≡ 2.65 -u.UnitTest ( 2 TaxAmount ⟨1‿0, 4‿25, 5‿50⟩) ≡ 0.25 -u.UnitTest ( 0 TaxAmount ⟨2‿50⟩) ≡ 0 -u.UnitTest (10 TaxAmount2 ⟨3‿50, 7‿10, 12‿25⟩) ≡ 2.65 -u.UnitTest ( 2 TaxAmount2 ⟨1‿0, 4‿25, 5‿50⟩) ≡ 0.25 -u.UnitTest ( 0 TaxAmount2 ⟨2‿50⟩) ≡ 0 -- cgit