aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2021-05-12 15:48:00 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2021-05-12 15:48:00 +0100
commitbef7b6d2e9c85f53aa646ab4d59bb52214406536 (patch)
tree2b52a9da082d7eac51540498eaebe7bbc9752ec4
parent435c5eb701ecb59b285559df3b43d60b5a919210 (diff)
downloadperlweeklychallenge-club-bef7b6d2e9c85f53aa646ab4d59bb52214406536.tar.gz
perlweeklychallenge-club-bef7b6d2e9c85f53aa646ab4d59bb52214406536.tar.bz2
perlweeklychallenge-club-bef7b6d2e9c85f53aa646ab4d59bb52214406536.zip
- Added Haskell solution by Ulrich Rieke.
-rw-r--r--challenge-112/ulrich-rieke/haskell/ch-2.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/challenge-112/ulrich-rieke/haskell/ch-2.hs b/challenge-112/ulrich-rieke/haskell/ch-2.hs
new file mode 100644
index 0000000000..9c935587e8
--- /dev/null
+++ b/challenge-112/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,8 @@
+module Challenge112
+ where
+import Data.List ( permutations , nub )
+
+stepcounter :: Int -> Int
+stepcounter n = length $ concat $ map (nub . permutations) [ replicate t 1 ++
+ replicate o 2 | t <- [0 .. n] , o <- [0 .. div n 2] , sum ( replicate t 1 ++
+ replicate o 2 ) == n]