diff options
| -rw-r--r-- | challenge-285/asherbhs/apl/ch-1.apls | 4 | ||||
| -rw-r--r-- | challenge-285/asherbhs/apl/ch-2.apls | 15 | ||||
| -rw-r--r-- | challenge-285/asherbhs/bqn/ch-1.bqn | 4 | ||||
| -rw-r--r-- | challenge-285/asherbhs/haskell/ch-1.hs | 16 | ||||
| -rw-r--r-- | challenge-285/asherbhs/hy/ch-1.hy | 10 | ||||
| -rw-r--r-- | challenge-285/asherbhs/j/ch-1.ijs | 5 | ||||
| -rw-r--r-- | challenge-285/asherbhs/k/ch-1.k | 4 | ||||
| -rw-r--r-- | challenge-285/asherbhs/raku/ch-1.raku | 6 |
8 files changed, 64 insertions, 0 deletions
diff --git a/challenge-285/asherbhs/apl/ch-1.apls b/challenge-285/asherbhs/apl/ch-1.apls new file mode 100644 index 0000000000..41e444b9d8 --- /dev/null +++ b/challenge-285/asherbhs/apl/ch-1.apls @@ -0,0 +1,4 @@ +NoConnection←{⊃⊃~⍨/↓⍉↑⍵} + +⎕←NoConnection 'BC' 'DB' 'CA' +⎕←NoConnection ,⊂'AZ' diff --git a/challenge-285/asherbhs/apl/ch-2.apls b/challenge-285/asherbhs/apl/ch-2.apls new file mode 100644 index 0000000000..16f7f5427a --- /dev/null +++ b/challenge-285/asherbhs/apl/ch-2.apls @@ -0,0 +1,15 @@ +MakingChange←{ + ⎕IO←0 + n←⍵ + n=0: 1 + t←1↑⍨n+1 + _←{ + c←⍵ + {{t[⍵]+←t[⍵-c]}⍣(⍵≥c)⊢⍵}¨1+⍳n + }¨1 5 10 25 50 + ⊃⌽t +} + +⎕←MakingChange 9 +⎕←MakingChange 15 +⎕←MakingChange 100 diff --git a/challenge-285/asherbhs/bqn/ch-1.bqn b/challenge-285/asherbhs/bqn/ch-1.bqn new file mode 100644 index 0000000000..d8bb6cc75f --- /dev/null +++ b/challenge-285/asherbhs/bqn/ch-1.bqn @@ -0,0 +1,4 @@ +NoConnection←{⊑(¬∘∊˜/⊢)˝⍉>𝕩} + +•Show NoConnection "BC"‿"DB"‿"CA" +•Show NoConnection ⋈"AZ" diff --git a/challenge-285/asherbhs/haskell/ch-1.hs b/challenge-285/asherbhs/haskell/ch-1.hs new file mode 100644 index 0000000000..de4ec71ebb --- /dev/null +++ b/challenge-285/asherbhs/haskell/ch-1.hs @@ -0,0 +1,16 @@ +import Data.Set (Set) +import qualified Data.Set as Set +import Data.Function (on) + +noConnection :: [(Char, Char)] -> Char +noConnection routes + = head + $ Set.toList + $ ((Set.\\) `on` Set.fromList) + (map snd routes) + (map fst routes) + +main :: IO () +main = do + print $ noConnection [('B', 'C'), ('D', 'B'), ('C', 'A')] + print $ noConnection [('A', 'Z')] diff --git a/challenge-285/asherbhs/hy/ch-1.hy b/challenge-285/asherbhs/hy/ch-1.hy new file mode 100644 index 0000000000..e7b04655d2 --- /dev/null +++ b/challenge-285/asherbhs/hy/ch-1.hy @@ -0,0 +1,10 @@ +(require hyrule *) + +(defn no-connection [routes] (do + (setv [from to] (map list (zip #* routes))) + (next (iter (- (set to) (set from)))) +)) + +(print (no-connection ["BC" "DB" "CA"])) +(print (no-connection ["AZ"])) + diff --git a/challenge-285/asherbhs/j/ch-1.ijs b/challenge-285/asherbhs/j/ch-1.ijs new file mode 100644 index 0000000000..8cccf6f28a --- /dev/null +++ b/challenge-285/asherbhs/j/ch-1.ijs @@ -0,0 +1,5 @@ +NoConnection=.{{{.(-.@e.~#])/|:>y}} + +echo NoConnection 'BC';'DB';'CA' +echo NoConnection <'AZ' +exit'' diff --git a/challenge-285/asherbhs/k/ch-1.k b/challenge-285/asherbhs/k/ch-1.k new file mode 100644 index 0000000000..598f79664d --- /dev/null +++ b/challenge-285/asherbhs/k/ch-1.k @@ -0,0 +1,4 @@ +NoConnection:*{y@&^x?y}/+: + +`0:NoConnection("BC";"DB";"CA") +`0:NoConnection@,"AZ" diff --git a/challenge-285/asherbhs/raku/ch-1.raku b/challenge-285/asherbhs/raku/ch-1.raku new file mode 100644 index 0000000000..df4dca1d61 --- /dev/null +++ b/challenge-285/asherbhs/raku/ch-1.raku @@ -0,0 +1,6 @@ +sub no-connection(@routes) { + (@routes»[1] ∖ @routes»[0]).keys.head +} + +say no-connection [["B", "C"], ["D", "B"], ["C", "A"]]; +say no-connection [["A", "Z"],]; |
