aboutsummaryrefslogtreecommitdiff
path: root/challenge-020
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-01-10 17:18:18 -0500
committerchirvasitua <stuart-little@users.noreply.github.com>2021-01-10 17:18:18 -0500
commitafb815c3dd567c2af3bb7ce53763865c46674b68 (patch)
treea28769ed3bb5af2329bf81c2326c4b121309e001 /challenge-020
parent3cc7bc349e724ea2c8c686feab31ec54c8de51f2 (diff)
downloadperlweeklychallenge-club-afb815c3dd567c2af3bb7ce53763865c46674b68.tar.gz
perlweeklychallenge-club-afb815c3dd567c2af3bb7ce53763865c46674b68.tar.bz2
perlweeklychallenge-club-afb815c3dd567c2af3bb7ce53763865c46674b68.zip
1st commit on 020_haskell
Diffstat (limited to 'challenge-020')
-rwxr-xr-xchallenge-020/stuart-little/haskell/ch-1.hs10
-rwxr-xr-xchallenge-020/stuart-little/haskell/ch-2.hs8
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-020/stuart-little/haskell/ch-1.hs b/challenge-020/stuart-little/haskell/ch-1.hs
new file mode 100755
index 0000000000..39cf5cbc6a
--- /dev/null
+++ b/challenge-020/stuart-little/haskell/ch-1.hs
@@ -0,0 +1,10 @@
+#!/usr/bin/env runghc
+
+-- run <script> <string>
+
+import System.Environment (getArgs,)
+import Data.List (group,)
+
+main = do
+ (str:_) <- getArgs
+ print $ group str
diff --git a/challenge-020/stuart-little/haskell/ch-2.hs b/challenge-020/stuart-little/haskell/ch-2.hs
new file mode 100755
index 0000000000..11b5a254d0
--- /dev/null
+++ b/challenge-020/stuart-little/haskell/ch-2.hs
@@ -0,0 +1,8 @@
+#!/usr/bin/env runghc
+
+-- run <script>
+
+import Math.NumberTheory.ArithmeticFunctions (sigma,)
+
+main = do
+ print $ let f x = sigma 1 x -x; ls = [(2::Int)..] in head $ dropWhile (\(x,y) -> x == y || f y /= x) $ zip ls $ map f ls