Created
June 24, 2020 19:37
-
-
Save brinchj/98b2591c3ff9af75c5e44858c3bcf3dd to your computer and use it in GitHub Desktop.
Mit navn det står i Haskell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import List | |
data AllToTheRight = AllToTheRight { | |
clown :: Int | |
, joker :: Int | |
} deriving (Show) | |
el h l a = reverse b where | |
(_, b) = foldl(\(a,b) h->(a+h,(l!!a):b))(a,[])h | |
doMe' t = map(\x-> -x*((mod x 2)*2-1)) a where | |
a = foldl(\h (a,b)->(floor$a**b):h)[] t | |
doMe = doMe'.(\x->(zip.reverse)x x) | |
main = do | |
putStr$(el(t++[42]) l$fs!!4) | |
where l = sort$show$ AllToTheRight 42 21 | |
t = foldl(\a b->a++b)[] $ | |
transpose[doMe[2,3],[-10,16]] | |
fs = 1:[i*(fs!!(i-1))|i<-[1..]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment