diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-05-29 12:25:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-29 12:25:43 +0100 |
| commit | 92535e9f0bf1e43973d60c52f855fd671e4eea7c (patch) | |
| tree | 733e3efd5768740226847abc6e41bfe646b86269 /challenge-166 | |
| parent | 8db1bb377c8e8302ae3e998e8fc674b9d45a6041 (diff) | |
| parent | 8f4c6bfe2d78c89a47f1dc12d2e010783a58f906 (diff) | |
| download | perlweeklychallenge-club-92535e9f0bf1e43973d60c52f855fd671e4eea7c.tar.gz perlweeklychallenge-club-92535e9f0bf1e43973d60c52f855fd671e4eea7c.tar.bz2 perlweeklychallenge-club-92535e9f0bf1e43973d60c52f855fd671e4eea7c.zip | |
Merge pull request #6170 from codereport/master
Week 166 in APL
Diffstat (limited to 'challenge-166')
| -rw-r--r-- | challenge-166/conor-hoekstra/ch-1.apl | 27 | ||||
| -rw-r--r-- | challenge-166/conor-hoekstra/ch-2.apl | 42 |
2 files changed, 69 insertions, 0 deletions
diff --git a/challenge-166/conor-hoekstra/ch-1.apl b/challenge-166/conor-hoekstra/ch-1.apl new file mode 100644 index 0000000000..1839b4d107 --- /dev/null +++ b/challenge-166/conor-hoekstra/ch-1.apl @@ -0,0 +1,27 @@ + d ← ⊃⎕NGET '/home/cph/perlweeklychallenge-club/data/dictionary.txt' 1 + + FROM ← 'olistabcdef' + TO ← '01157abcdef' + + hexWord ← {((2∘≤∧8∘≥)≢⍵)∧∧/⍵∊FROM} + toHex ← {TO[FROM⍳⍵]} + + ⍝ Number of "hex words" + ≢(hexWord¨⊢⍤/⊢) d +1463 + + ⍝ First 36 "hex words" + 6 6⍴36↑toHex¨(hexWord¨⊢⍤/⊢) d +┌────────┬───────┬────────┬────────┬────────┬────────┐ +│aba7e │aba7ed │aba7e5 │abb07 │abb075 │abd1ca7e│ +├────────┼───────┼────────┼────────┼────────┼────────┤ +│abe7 │abe75 │abe77ed │ab1de │ab1de5 │ab1e │ +├────────┼───────┼────────┼────────┼────────┼────────┤ +│ab1e57 │ab0de │ab0de5 │ab5ce55 │accede │acceded │ +├────────┼───────┼────────┼────────┼────────┼────────┤ +│accede5 │acce55 │acce55ed│acce55e5│acc01ade│acc057 │ +├────────┼───────┼────────┼────────┼────────┼────────┤ +│acc057ed│acc0575│ace │aced │ace5 │ac1d │ +├────────┼───────┼────────┼────────┼────────┼────────┤ +│ac1d5 │ac7 │ac7ed │ac75 │ad │add │ +└────────┴───────┴────────┴────────┴────────┴────────┘ diff --git a/challenge-166/conor-hoekstra/ch-2.apl b/challenge-166/conor-hoekstra/ch-2.apl new file mode 100644 index 0000000000..8a1f8c1334 --- /dev/null +++ b/challenge-166/conor-hoekstra/ch-2.apl @@ -0,0 +1,42 @@ + dirs ← ('Arial.ttf' 'Comic_Sans.ttf' ⍝ ... + headers ← ('Dir A')('Dir B')('Dir C') + + ⍝ Formatted data + headers⍪⍉↑dirs +┌──────────────┬───────────────┬───────────────┐ +│Dir A │Dir B │Dir C │ +├──────────────┼───────────────┼───────────────┤ +│Arial.ttf │Arial.ttf │Arial.ttf │ +├──────────────┼───────────────┼───────────────┤ +│Comic_Sans.ttf│Comic_Sans.ttf │Courier_New.ttf│ +├──────────────┼───────────────┼───────────────┤ +│Georgia.ttf │Courier_New.ttf│Helvetica.ttf │ +├──────────────┼───────────────┼───────────────┤ +│Helvetica.ttf │Helvetica.ttf │Impact.otf │ +├──────────────┼───────────────┼───────────────┤ +│Impact.otf │Impact.otf │Monaco.ttf │ +├──────────────┼───────────────┼───────────────┤ +│Verdana.ttf │Tahoma.ttf │Verdana.ttf │ +├──────────────┼───────────────┼───────────────┤ +│Old_Fonts/ │Verdana.ttf │ │ +└──────────────┴───────────────┴───────────────┘ + + u ← ∪⊃,/dirs ⍝ unique + c ← u/⍨⊃∧/u∘∊¨dirs ⍝ common + + headers⍪⍉↑{c~⍨⍵/¨u}¨u∘∊¨dirs +┌──────────────┬───────────────┬───────────────┐ +│Dir A │Dir B │Dir C │ +├──────────────┼───────────────┼───────────────┤ +│Comic_Sans.ttf│Comic_Sans.ttf │ │ +├──────────────┼───────────────┼───────────────┤ +│Georgia.ttf │ │ │ +├──────────────┼───────────────┼───────────────┤ +│Old_Fonts/ │ │ │ +├──────────────┼───────────────┼───────────────┤ +│ │Courier_New.ttf│Courier_New.ttf│ +├──────────────┼───────────────┼───────────────┤ +│ │Tahoma.ttf │ │ +├──────────────┼───────────────┼───────────────┤ +│ │ │Monaco.ttf │ +└──────────────┴───────────────┴───────────────┘
\ No newline at end of file |
