aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-01-12 01:23:05 +0000
committerGitHub <noreply@github.com>2021-01-12 01:23:05 +0000
commit017145744161d53f08c461310b43f242f36ff69b (patch)
treec6dcf814c2f531e1c834bac51a83dccc4b275144
parenteb7014e3f74245a76a943999bbee0fe0e000c603 (diff)
parent187269407154d73d0c6ae04e9c790e2f1047fe2d (diff)
downloadperlweeklychallenge-club-017145744161d53f08c461310b43f242f36ff69b.tar.gz
perlweeklychallenge-club-017145744161d53f08c461310b43f242f36ff69b.tar.bz2
perlweeklychallenge-club-017145744161d53f08c461310b43f242f36ff69b.zip
Merge pull request #3226 from stuart-little/stuart-little_023_haskell
1st commit on 023_haskell
-rwxr-xr-xchallenge-023/stuart-little/haskell/ch-1.hs13
-rwxr-xr-xchallenge-023/stuart-little/haskell/ch-2.hs10
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-023/stuart-little/haskell/ch-1.hs b/challenge-023/stuart-little/haskell/ch-1.hs
new file mode 100755
index 0000000000..cb2f3fde77
--- /dev/null
+++ b/challenge-023/stuart-little/haskell/ch-1.hs
@@ -0,0 +1,13 @@
+#!/usr/bin/env runghc
+
+-- run <script> <difference_order> <space-separated numbers>
+
+{-# LANGUAGE PackageImports #-}
+
+import System.Environment (getArgs,)
+import "ghc" Util (nTimes,)
+
+main = do
+ args <- getArgs
+ let (ord:nrs) = map (read::String->Int) args
+ print $ nTimes ord (\xs -> zipWith (-) (tail xs) xs) nrs
diff --git a/challenge-023/stuart-little/haskell/ch-2.hs b/challenge-023/stuart-little/haskell/ch-2.hs
new file mode 100755
index 0000000000..45877d08d5
--- /dev/null
+++ b/challenge-023/stuart-little/haskell/ch-2.hs
@@ -0,0 +1,10 @@
+#!/usr/bin/env runghc
+
+-- run <script> <number>
+
+import System.Environment (getArgs,)
+import Data.Numbers.Primes (primeFactors,)
+
+main = do
+ (nr:_) <- getArgs
+ print $ primeFactors (read nr::Int)