aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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