mirror of
https://github.com/sbrow/risk-multilang.git
synced 2025-12-30 00:47:39 -05:00
feat: Added Haskell and Go.
This commit is contained in:
19
haskell/app/Main.hs
Normal file
19
haskell/app/Main.hs
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env stack
|
||||
-- stack runghc
|
||||
|
||||
import Risk
|
||||
|
||||
maximum' :: Ord a => [a] -> a
|
||||
maximum' = foldr1 (\x y ->if x >= y then x else y)
|
||||
|
||||
maximum'' :: Ord a => [a] -> a
|
||||
maximum'' [x] = x
|
||||
maximum'' (x:x':xs) = maximum' ((if x >= x' then x else x'):xs)
|
||||
|
||||
a :: [Int]
|
||||
a = [3,5,8,6]
|
||||
|
||||
main :: IO ()
|
||||
main = print $ maximum'' a
|
||||
-- main = print $ possibleOutcomes 3 3
|
||||
-- main = print $ Result(3, 5) + Result(1, 2)
|
||||
Reference in New Issue
Block a user