aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-02-01 07:38:48 -0500
committerchirvasitua <stuart-little@users.noreply.github.com>2021-02-01 07:38:48 -0500
commit53dee3c83e7d037a86acb667852192847f700e0b (patch)
tree2ef7d6c762b2084510dd53a47d1ea1dc98605ba1
parentac60bddb13f96402c3026283fe223388ed54fc27 (diff)
downloadperlweeklychallenge-club-53dee3c83e7d037a86acb667852192847f700e0b.tar.gz
perlweeklychallenge-club-53dee3c83e7d037a86acb667852192847f700e0b.tar.bz2
perlweeklychallenge-club-53dee3c83e7d037a86acb667852192847f700e0b.zip
1st commit on 098_haskell
-rwxr-xr-xchallenge-098/stuart-little/haskell/ch-1.hs10
-rwxr-xr-xchallenge-098/stuart-little/haskell/ch-2.hs9
2 files changed, 19 insertions, 0 deletions
diff --git a/challenge-098/stuart-little/haskell/ch-1.hs b/challenge-098/stuart-little/haskell/ch-1.hs
new file mode 100755
index 0000000000..d14d005e54
--- /dev/null
+++ b/challenge-098/stuart-little/haskell/ch-1.hs
@@ -0,0 +1,10 @@
+#!/usr/bin/env runghc
+
+-- run <script> <path-to-file> <number>
+
+import System.Environment (getArgs)
+
+main = do
+ (path:nr:_) <- getArgs
+ txt <- readFile path
+ putStrLn $ take (read nr::Int) txt
diff --git a/challenge-098/stuart-little/haskell/ch-2.hs b/challenge-098/stuart-little/haskell/ch-2.hs
new file mode 100755
index 0000000000..2108eeb2d7
--- /dev/null
+++ b/challenge-098/stuart-little/haskell/ch-2.hs
@@ -0,0 +1,9 @@
+#!/usr/bin/env runghc
+
+-- run <script> <target> <space-separated array entries>
+
+import System.Environment (getArgs)
+
+main = do
+ (tgt:arr) <- getArgs >>= return . map (read::String->Int)
+ putStrLn $ show $ length $ filter (< tgt) arr