
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Prelude> 5 > 7 False Prelude> 1== False Prelude> 5 < 7 && 1 != True
myand True False = False myand True True = True myand False False = False myand False True = False
plus :: Int -> Int -> Int plus x y = if x == 0 then y else 1 + (plus (x-1) y) len :: [a] -> Int len [] = 0 len (x:xs) = 1 + (len xs) even, odd :: Int -> Bool even 0 = True
f x = (x*0) = x Main> :r Reading file "lect01.hs": ERROR "lect01.hs" (line 36): Syntax error in input (unexpected `=') Main>
lastone2 = head. rev Main> :r Reading script file "lect01.hs": ERROR "lect01.hs" (line 38): Undefined variable "rev" Main>
Prelude> :t head head :: [a] -> a Prelude> head True ERROR: Type error in application *** expression : hd True *** term : True *** type : Bool *** does not match : [a] Prelude> head 1 ERROR - Illegal Haskell 98 class constraint in inferred type *** Expression : head 1 *** Type : Num [a] => a
difference x y = if x>=y then x-y else y-x Main> :type difference difference :: (Ord a, Num a) => a -> a -> a Main> difference 3 4
Main> difference 4.5 7. -3. Main>