GHCi, version 7.4.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading *package base ... linking ... done. Prelude> :load "BindingExamples.hs" [1 of 1] Compiling BindingExamples ( BindingExamples.hs, interpreted ) Ok, modules loaded: BindingExamples. *BindingExamples> let (x,y,z) = (1,2,3) in x 1 *BindingExamples> let (x,y,z) = (1,2,3) in x*y+z 5 *BindingExamples> let (x,y,z,w) = (1,2,3) in x :5:17: Couldn't match expected type `(t0, t1, t2, t3)' with actual type `(t4, t5, t6)' In the expression: (1, 2, 3) In a pattern binding: (x, y, z, w) = (1, 2, 3) In the expression: let (x, y, z, w) = (1, 2, 3) in x *BindingExamples> let x = 10 in x*x 100 *BindingExamples> let (x,y) = (3,4,5) in x*10*y :7:13: Couldn't match expected type `(t0, t1)' with actual type `(t2, t3, t4)' In the expression: (3, 4, 5) In a pattern binding: (x, y) = (3, 4, 5) In the expression: let (x, y) = (3, 4, 5) in x * 10 * y *BindingExamples> let (x,y,_) = (3,4,5) in x*10*y 120 *BindingExamples> let (x,x,_) = (3,4,5) in x*10 :9:6: Conflicting definitions for `x' Bound at: :9:6 :9:8 *BindingExamples> let (x,x,_) = (3,4,5) in x*10 :10:6: Conflicting definitions for `x' Bound at: :10:6 :10:8 *BindingExamples> let (x,y,z) = (3,4,5) in z 5 *BindingExamples> let (x,x,_) = (4,4,5) in x*10 :12:6: Conflicting definitions for `x' Bound at: :12:6 :12:8 *BindingExamples> let (x,_,_) = (3,4,5) in x*10 30 *BindingExamples> :cd c:/cygwin/home/leavens/classes/cop4020/lectures/haskell-functional/ Warning: changing directory causes all loaded modules to be unloaded, because the search path has changed. Prelude> :load "Yodaize.hs" [1 of 1] Compiling Yodaize ( Yodaize.hs, interpreted ) Ok, modules loaded: Yodaize. *Yodaize> yodaize ("you", "will", "program") ("program","you","will") *Yodaize> :type yodaize yodaize :: (t1, t2, t) -> (t, t1, t2) *Yodaize> :load "Yodaize.hs" [1 of 1] Compiling Yodaize ( Yodaize.hs, interpreted ) Ok, modules loaded: Yodaize. *Yodaize> yodaize ("you","feel","forceful") ("forceful","you","feel") *Yodaize> :load "Max3InClass.hs" [1 of 1] Compiling Max3InClass ( Max3InClass.hs, interpreted ) Max3InClass.hs:4:16: No instance for (Ord a) arising from a use of `max' In the expression: max z (max x y) In an equation for `max3': max3 (x, y, z) = max z (max x y) Failed, modules loaded: none. Prelude> :load "Max3InClass.hs" [1 of 1] Compiling Max3InClass ( Max3InClass.hs, interpreted ) Ok, modules loaded: Max3InClass. *Max3InClass> max3 (7,8,0) 8 *Max3InClass> max3 ("hans","leila","luke") "luke" *Max3InClass> :type "hi" "hi" :: [Char] *Max3InClass> 8 > 'a' :25:1: No instance for (Num Char) arising from the literal `8' Possible fix: add an instance declaration for (Num Char) In the first argument of `(>)', namely `8' In the expression: 8 > 'a' In an equation for `it': it = 8 > 'a' *Max3InClass> 8 == 'a' :26:1: No instance for (Num Char) arising from the literal `8' Possible fix: add an instance declaration for (Num Char) In the first argument of `(==)', namely `8' In the expression: 8 == 'a' In an equation for `it': it = 8 == 'a' *Max3InClass> :load "AverageInClass.hs" [1 of 1] Compiling AverageInClass ( AverageInClass.hs, interpreted ) Ok, modules loaded: AverageInClass. *AverageInClass> [x | x <- [1 .. 10], even x] [2,4,6,8,10] *AverageInClass> [x*10 | x <- [1 .. 10], even x, x > 5] [60,80,100] *AverageInClass> [y*3 | y <- [1,4 .. 100]] [3,12,21,30,39,48,57,66,75,84,93,102,111,120,129,138,147,156,165,174,183,192,201,210,219,228,237,246,255,264,273,282,291,300] *AverageInClass> map (\x -> 3*x) [1,2,3,5,1] [3,6,9,15,3] *AverageInClass>