data prac

Run Settings
LanguageHaskell
Language Version
Run Command
data Area = Circle Float | Square Float Float surface :: Area -> Float surface (Circle r) = pi * r ^ 2 surface (Square l w) = l * w add :: Int -> Int -> Int add x y = x + y fact :: Int -> Int fact 2 = 2 fact n = n * fact (n-1) sumL :: [Int] -> Int sumL x | null x = 0 | not $ null x = head x + sumL (tail x) sumY :: [Int] -> Int sumY [] = 0 sumY (x:xs) = x + sumY xs --for :: main = do print (surface $ Circle 10 ) print (surface $ Square 10 5 ) let x = add 1 2 print(x) print(fact 5) print(sumL [1,2,3]) print(sumY [1,2,3]) let y = 5 print (y:[1,2,3])
Editor Settings
Theme
Key bindings
Full width
Lines