projprog/fstfunc.hs
2022-01-03 10:10:16 +01:00

20 lines
434 B
Haskell
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{-# LANGUAGE ParallelListComp #-}
addTwo :: Num a => a -> a
addTwo x = x + 2
threeParam :: Num a => a -> a -> a -> a
threeParam x y z = let w = x+y in w*z
myFirst :: (a,b) -> a
myFirst t = let (x,y)=t in x
okko :: [Int] -> [[Char]]
okko xs = [if x<10 then "OK" else "KO" | x <- xs]
addList :: [Int] -> [Int] -> [Int]
addList xs ys = [x+y | x <- xs, y <- ys]
length2 :: [a] -> Int
length2 xs = last [n | _ <- xs | n <- [2,4..]]