aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-01-01 06:33:55 +0000
committerGitHub <noreply@github.com>2021-01-01 06:33:55 +0000
commit8a0d6cea7e2bbc24135379bde8a219653081bc40 (patch)
treec07b6722a6eed5fdc9f1f446d2e74ab78e613bb4
parent700e67e90a02f3e6f7845e1edc4c3c426d7b4b37 (diff)
parente75811dc44f1b565b8619f4600c7af407deb3a43 (diff)
downloadperlweeklychallenge-club-8a0d6cea7e2bbc24135379bde8a219653081bc40.tar.gz
perlweeklychallenge-club-8a0d6cea7e2bbc24135379bde8a219653081bc40.tar.bz2
perlweeklychallenge-club-8a0d6cea7e2bbc24135379bde8a219653081bc40.zip
Merge pull request #3118 from stuart-little/stuart-little080_haskell
1st commit on 080_haskell
-rw-r--r--challenge-080/stuart-little/README2
-rwxr-xr-xchallenge-080/stuart-little/haskell/ch-1.hs12
-rwxr-xr-xchallenge-080/stuart-little/haskell/ch-2.hs12
3 files changed, 25 insertions, 1 deletions
diff --git a/challenge-080/stuart-little/README b/challenge-080/stuart-little/README
index 76119cbbb8..78439907de 100644
--- a/challenge-080/stuart-little/README
+++ b/challenge-080/stuart-little/README
@@ -1 +1 @@
-Solutions by Stuart Little.
+Solutions by Stuart Little
diff --git a/challenge-080/stuart-little/haskell/ch-1.hs b/challenge-080/stuart-little/haskell/ch-1.hs
new file mode 100755
index 0000000000..5390e9585e
--- /dev/null
+++ b/challenge-080/stuart-little/haskell/ch-1.hs
@@ -0,0 +1,12 @@
+#!/usr/bin/env runghc
+
+-- run as <script> <space-separated array entries>
+
+import System.Environment
+import Data.List
+
+firstMisPos a = head [x | x <- [1..], notElem x a]
+
+main = do
+ args <- getArgs
+ print $ firstMisPos $ map (\y -> read y::Integer) args
diff --git a/challenge-080/stuart-little/haskell/ch-2.hs b/challenge-080/stuart-little/haskell/ch-2.hs
new file mode 100755
index 0000000000..11b32ca791
--- /dev/null
+++ b/challenge-080/stuart-little/haskell/ch-2.hs
@@ -0,0 +1,12 @@
+#!/usr/bin/env runghc
+
+-- run as <script> <space-separated array entries>
+
+import System.Environment
+import Data.List
+
+candy a = (length a) + (length $ filter ((/=) 0) $ zipWith (-) a $ tail a)
+
+main = do
+ args <- getArgs
+ print $ candy $ map (\y -> read y::Integer) args