aboutsummaryrefslogtreecommitdiff
path: root/challenge-080
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2020-12-31 02:04:10 -0500
committerchirvasitua <stuart-little@users.noreply.github.com>2020-12-31 02:04:10 -0500
commit3dde28d7246a24ad62ba6d51f6b1e99b9441fa7b (patch)
treef8600f7335b7ba5eb14e837380fbec6e5318b912 /challenge-080
parentb22bd539ab5083cf0a8cbfab18f6107403751851 (diff)
downloadperlweeklychallenge-club-3dde28d7246a24ad62ba6d51f6b1e99b9441fa7b.tar.gz
perlweeklychallenge-club-3dde28d7246a24ad62ba6d51f6b1e99b9441fa7b.tar.bz2
perlweeklychallenge-club-3dde28d7246a24ad62ba6d51f6b1e99b9441fa7b.zip
1st commit on 080_haskell
Diffstat (limited to 'challenge-080')
-rw-r--r--challenge-080/stuart-little/README2
-rwxr-xr-xchallenge-080/stuart-little/haskell/080_ch-1.hs12
-rwxr-xr-xchallenge-080/stuart-little/haskell/080_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/080_ch-1.hs b/challenge-080/stuart-little/haskell/080_ch-1.hs
new file mode 100755
index 0000000000..5390e9585e
--- /dev/null
+++ b/challenge-080/stuart-little/haskell/080_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/080_ch-2.hs b/challenge-080/stuart-little/haskell/080_ch-2.hs
new file mode 100755
index 0000000000..11b32ca791
--- /dev/null
+++ b/challenge-080/stuart-little/haskell/080_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