diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-10-10 08:45:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-10 08:45:09 +0100 |
| commit | a1225ecc106f7fdc293ae013e843b9d25bfe240d (patch) | |
| tree | 903f0f26af0f5f4deabe2e5d27c3ca85068a85b4 | |
| parent | 04d16021b79eb3b8a65eb1eadd8871ab2ef83b6a (diff) | |
| parent | 51966386e30682ec3c5bf763a402a9178f6a0a88 (diff) | |
| download | perlweeklychallenge-club-a1225ecc106f7fdc293ae013e843b9d25bfe240d.tar.gz perlweeklychallenge-club-a1225ecc106f7fdc293ae013e843b9d25bfe240d.tar.bz2 perlweeklychallenge-club-a1225ecc106f7fdc293ae013e843b9d25bfe240d.zip | |
Merge pull request #4995 from codereport/master
APL and BQN solutions for Weeks 33/40/42/73
| -rw-r--r-- | challenge-033/conor-hoekstra/ch-02.apl | 14 | ||||
| -rw-r--r-- | challenge-040/conor-hoekstra/ch-01.apl | 13 | ||||
| -rw-r--r-- | challenge-040/conor-hoekstra/ch-02.apl | 4 | ||||
| -rw-r--r-- | challenge-040/conor-hoekstra/ch-02.bqn | 4 | ||||
| -rw-r--r-- | challenge-042/conor-hoekstra/ch-01.apl | 10 | ||||
| -rw-r--r-- | challenge-042/conor-hoekstra/ch-02.apl | 20 | ||||
| -rw-r--r-- | challenge-073/conor-hoekstra/ch-01.apl | 4 | ||||
| -rw-r--r-- | challenge-073/conor-hoekstra/ch-01.bqn | 4 | ||||
| -rw-r--r-- | challenge-073/conor-hoekstra/ch-02.apl | 5 | ||||
| -rw-r--r-- | challenge-073/conor-hoekstra/ch-02.bqn | 5 |
10 files changed, 83 insertions, 0 deletions
diff --git a/challenge-033/conor-hoekstra/ch-02.apl b/challenge-033/conor-hoekstra/ch-02.apl new file mode 100644 index 0000000000..da2b91a61e --- /dev/null +++ b/challenge-033/conor-hoekstra/ch-02.apl @@ -0,0 +1,14 @@ +multiplicationTable ← (' '@(0=⊢))∘.(××≤)⍨⍳11 + +⍝ Output +1 2 3 4 5 6 7 8 9 10 11 + 4 6 8 10 12 14 16 18 20 22 + 9 12 15 18 21 24 27 30 33 + 16 20 24 28 32 36 40 44 + 25 30 35 40 45 50 55 + 36 42 48 54 60 66 + 49 56 63 70 77 + 64 72 80 88 + 81 90 99 + 100 110 + 121 diff --git a/challenge-040/conor-hoekstra/ch-01.apl b/challenge-040/conor-hoekstra/ch-01.apl new file mode 100644 index 0000000000..99d6f69a2e --- /dev/null +++ b/challenge-040/conor-hoekstra/ch-01.apl @@ -0,0 +1,13 @@ +solution ← ⍉ + +⍝ Tests +input ← ↑'ILOVEYOU' '24032019' '!?£$%^&*' +solution input +I2! +L4? +O0£ +V3$ +E2% +Y0^ +O1& +U9* diff --git a/challenge-040/conor-hoekstra/ch-02.apl b/challenge-040/conor-hoekstra/ch-02.apl new file mode 100644 index 0000000000..f905e1f53a --- /dev/null +++ b/challenge-040/conor-hoekstra/ch-02.apl @@ -0,0 +1,4 @@ +solution ← {(⊂⍤⍋⌷⊢)@(1+⍺)⊢⍵} + +⍝ Tests +0 2 5 solution 10 4 1 8 12 3 ⍝ 1 4 3 8 12 10 diff --git a/challenge-040/conor-hoekstra/ch-02.bqn b/challenge-040/conor-hoekstra/ch-02.bqn new file mode 100644 index 0000000000..fdb49aba6b --- /dev/null +++ b/challenge-040/conor-hoekstra/ch-02.bqn @@ -0,0 +1,4 @@ +Solution ← {∧⌾(𝕨⊸⊏)𝕩} + +# Tests +0‿2‿5 Solution 10‿4‿1‿8‿12‿3 # ⟨ 1 4 3 8 12 10 ⟩ diff --git a/challenge-042/conor-hoekstra/ch-01.apl b/challenge-042/conor-hoekstra/ch-01.apl new file mode 100644 index 0000000000..5a01efcfb5 --- /dev/null +++ b/challenge-042/conor-hoekstra/ch-01.apl @@ -0,0 +1,10 @@ +octal ← 10⊥8(⊥⍣¯1)⊢ + +⍝ Output +5 10⍴ octal ⍳50 + 1 2 3 4 5 6 7 10 11 12 +13 14 15 16 17 20 21 22 23 24 +25 26 27 30 31 32 33 34 35 36 +37 40 41 42 43 44 45 46 47 50 +51 52 53 54 55 56 57 60 61 62 +
\ No newline at end of file diff --git a/challenge-042/conor-hoekstra/ch-02.apl b/challenge-042/conor-hoekstra/ch-02.apl new file mode 100644 index 0000000000..0e8c692c3d --- /dev/null +++ b/challenge-042/conor-hoekstra/ch-02.apl @@ -0,0 +1,20 @@ +isValid ← ((0=⊃∘⌽)∧0∧.≤⊢)∘(+\-⌿)'()'∘.=⊢ + +⍝ Tests +(isValid,⊢) '()'[?2⍴⍨?10] ⍝ 0 ()))))()( +(isValid,⊢) '()'[?2⍴⍨?10] ⍝ 1 (()) +(isValid,⊢) '()'[?2⍴⍨?10] ⍝ 0 (((()) +(isValid,⊢) '()'[?2⍴⍨?10] ⍝ 1 ()((())) +(isValid,⊢) '()'[?2⍴⍨?10] ⍝ 0 ((( + +⍝ Tacit Tree Visualization + + isValid + ┌────┴─────┐ + ∘ ┌──┼─┐ + ┌─────┴─────┐ () . ⊢ + ┌───┼───┐ ┌─┴─┐ ┌┴┐ +┌─┼─┐ ∧ ┌─┼─┐ \ ⌿ ∘ = +0 = ∘ 0 . ⊢ ┌─┘ ┌─┘ + ┌┴┐ ┌┴┐ + - + ⊃ ⌽ ∧ ≤ diff --git a/challenge-073/conor-hoekstra/ch-01.apl b/challenge-073/conor-hoekstra/ch-01.apl new file mode 100644 index 0000000000..302221e932 --- /dev/null +++ b/challenge-073/conor-hoekstra/ch-01.apl @@ -0,0 +1,4 @@ +solution ← 3⌊/⊢ + +⍝ Tests +solution 1 5 0 2 9 3 7 6 4 8 ⍝ 0 0 0 2 3 3 4 4 diff --git a/challenge-073/conor-hoekstra/ch-01.bqn b/challenge-073/conor-hoekstra/ch-01.bqn new file mode 100644 index 0000000000..b7c889e6ae --- /dev/null +++ b/challenge-073/conor-hoekstra/ch-01.bqn @@ -0,0 +1,4 @@ +Solution ← ⌊´⎉1 3↕⊢ + +# Tests +Solution 1‿5‿0‿2‿9‿3‿7‿6‿4‿8 # ⟨ 0 0 0 2 3 3 4 4 ⟩ diff --git a/challenge-073/conor-hoekstra/ch-02.apl b/challenge-073/conor-hoekstra/ch-02.apl new file mode 100644 index 0000000000..d83cb0a9c2 --- /dev/null +++ b/challenge-073/conor-hoekstra/ch-02.apl @@ -0,0 +1,5 @@ +solution ← (⌊/(⊣×≠)⊃∘⌽)¨,\ + +⍝ Tests +solution 7 8 3 12 10 ⍝ 0 7 0 3 3 +solution 4 6 5 ⍝ 0 4 4 diff --git a/challenge-073/conor-hoekstra/ch-02.bqn b/challenge-073/conor-hoekstra/ch-02.bqn new file mode 100644 index 0000000000..138ed10180 --- /dev/null +++ b/challenge-073/conor-hoekstra/ch-02.bqn @@ -0,0 +1,5 @@ +Solution ← (⌊´(⊣×≠)⊑∘⌽)¨1⊸↓∘↑ + +# Tests +Solution 7‿8‿3‿12‿10 # ⟨ 0 7 0 3 3 ⟩ +Solution 4‿6‿5 # ⟨ 0 4 4 ⟩ |
