aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-01-10 22:27:32 +0000
committerGitHub <noreply@github.com>2021-01-10 22:27:32 +0000
commite1c01e07a7d895b8ae34d7eb88732dfb83e59fe9 (patch)
treea28769ed3bb5af2329bf81c2326c4b121309e001
parent3cc7bc349e724ea2c8c686feab31ec54c8de51f2 (diff)
parentafb815c3dd567c2af3bb7ce53763865c46674b68 (diff)
downloadperlweeklychallenge-club-e1c01e07a7d895b8ae34d7eb88732dfb83e59fe9.tar.gz
perlweeklychallenge-club-e1c01e07a7d895b8ae34d7eb88732dfb83e59fe9.tar.bz2
perlweeklychallenge-club-e1c01e07a7d895b8ae34d7eb88732dfb83e59fe9.zip
Merge pull request #3214 from stuart-little/stuart-little_020_haskell
1st commit on 020_haskell
-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