aboutsummaryrefslogtreecommitdiff
path: root/challenge-053/stuart-little/haskell
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-01-04 17:51:13 -0500
committerchirvasitua <stuart-little@users.noreply.github.com>2021-01-04 17:51:13 -0500
commit887783ee4a796d0ba8e1ece644b3f07ebb3c6159 (patch)
tree99f25b33294b394486ab2cfcae12a65634060203 /challenge-053/stuart-little/haskell
parentfb142b014a5e6273a166ca4204df522046b9c236 (diff)
downloadperlweeklychallenge-club-887783ee4a796d0ba8e1ece644b3f07ebb3c6159.tar.gz
perlweeklychallenge-club-887783ee4a796d0ba8e1ece644b3f07ebb3c6159.tar.bz2
perlweeklychallenge-club-887783ee4a796d0ba8e1ece644b3f07ebb3c6159.zip
1st commit on 053_haskell
Diffstat (limited to 'challenge-053/stuart-little/haskell')
-rwxr-xr-xchallenge-053/stuart-little/haskell/ch-1.hs11
-rwxr-xr-xchallenge-053/stuart-little/haskell/ch-2.hs17
2 files changed, 28 insertions, 0 deletions
diff --git a/challenge-053/stuart-little/haskell/ch-1.hs b/challenge-053/stuart-little/haskell/ch-1.hs
new file mode 100755
index 0000000000..042f2c72ad
--- /dev/null
+++ b/challenge-053/stuart-little/haskell/ch-1.hs
@@ -0,0 +1,11 @@
+#!/usr/bin/env runghc
+
+-- run <script>
+
+import Data.List (transpose,intercalate,)
+import Data.List.Split (chunksOf,)
+
+rot90 mat = map reverse $ transpose mat
+
+main = do
+ mapM_ putStrLn $ map (((replicate 40 '-') ++ "\n") ++) $ map (intercalate "\n") $ (map.map) unwords $ take 4 $ iterate rot90 $ (map.map) show $ chunksOf 3 [1..9]
diff --git a/challenge-053/stuart-little/haskell/ch-2.hs b/challenge-053/stuart-little/haskell/ch-2.hs
new file mode 100755
index 0000000000..60564c2216
--- /dev/null
+++ b/challenge-053/stuart-little/haskell/ch-2.hs
@@ -0,0 +1,17 @@
+#!/usr/bin/env runghc
+
+-- run <script> <desired word-length>
+
+import System.Environment (getArgs,)
+import Data.Tree (unfoldForest,levels,)
+import Data.List (isPrefixOf,)
+
+appendAlwd w = (w, map (\c -> (w ++ [c])) $ map last $ filter (isPrefixOf $ [last w]) alwd)
+ where alwd=["ae","ai","ei","ia","ie","io","iu","oa","ou","uo","ue"]
+
+frst = unfoldForest appendAlwd $ map (\x -> [x]) "aeiou"
+
+main = do
+ args <- getArgs
+ let lng = read (args !! 0)::Int
+ mapM_ putStrLn $ concat $ map last $ map (take lng) $ map levels $ frst