poole@CPSC-M-POOLE01 haskell % ghci GHCi, version 9.4.8: https://www.haskell.org/ghc/ :? for help ghci> filter (\ x -> (x < 3) || (x > 7)) [1..10] [1,2,8,9,10] ghci> myadd = \x y -> x+y ghci> myadd 3 6 9 ghci> [x^2 | x <- [1..7], x `mod` 2 == 1] [1,9,25,49] ghci> [x+y | (x,y) <- [(1,2),(4,3),(5,6)]] [3,7,11] ghci> [x+y | (x,y) <- [(1,2),(4,3),(5,6)], x dp l1 l2 = sum [x*y | (x,y) <- zip l1 l2] ghci> dp [1..4] [5,4,3,2,1] 30 ghci> even n = 0 == mod n 2 ghci> [even x | x <- [1,2,3,4,5,6]] [False,True,False,True,False,True] ghci> [x | x <- [1,2,3,4,5,6], even x] [2,4,6] ghci> :load Lists3 [1 of 1] Compiling Lists3 ( Lists3.hs, interpreted ) Lists3.hs:11:17: error: Ambiguous occurrence ‘sum’ It could refer to either ‘Prelude.sum’, imported from ‘Prelude’ at Lists3.hs:2:8-13 (and originally defined in ‘Data.Foldable’) or ‘Lists3.sum’, defined at Lists3.hs:10:1 | 11 | sum (h:t) = h + sum t | ^^^ Failed, no modules loaded. ghci> :load Lists3 [1 of 1] Compiling Lists3 ( Lists3.hs, interpreted ) Lists3.hs:11:17: error: Ambiguous occurrence ‘sum’ It could refer to either ‘Prelude.sum’, imported from ‘Prelude’ at Lists3.hs:2:8-13 (and originally defined in ‘Data.Foldable’) or ‘Lists3.sum’, defined at Lists3.hs:10:1 | 11 | sum (h:t) = h + sum t | ^^^ Failed, no modules loaded. ghci> :load Lists3 [1 of 1] Compiling Lists3 ( Lists3.hs, interpreted ) Ok, one module loaded. ghci> sm [1..10] 55 ghci> myfoldr (*) 1 [1..10] 3628800 ghci> myfoldr (+) 0 [1..10] 55 ghci> myfoldr (:) [45,55,65] [1..3] [1,2,3,45,55,65] ghci> myapp l1 l2 = myfoldr (:) l2 l1 ghci> myapp [45,55,65] [1..3] [45,55,65,1,2,3] ghci> myapp2 = flip (myfoldr (:)) ghci> myapp2 [45,55,65] [1..3] [45,55,65,1,2,3] ghci> dp l1 l2 = myfoldr (\ (x,y) r -> x*y + r) 0 (zip l1 l2) ghci> dp [45,55,65] [1..3] 350 ghci> dotprod [1..5] [11..15] 205 ghci> Leaving GHCi. poole@CPSC-M-POOLE01 haskell % cd as1 cd: no such file or directory: as1 poole@CPSC-M-POOLE01 haskell % ghci GHCi, version 9.4.8: https://www.haskell.org/ghc/ :? for help ghci> Leaving GHCi. poole@CPSC-M-POOLE01 haskell % cd ../as1 poole@CPSC-M-POOLE01 as1 % ghci GHCi, version 9.4.8: https://www.haskell.org/ghc/ :? for help ghci> :l As1sol.hs [1 of 2] Compiling Main ( As1sol.hs, interpreted ) Ok, one module loaded. ghci> wins 0.6 3 3 0.68256 ghci> wins 0.5 2 3 0.6875 ghci> delna 2 'a' "avatar" ["vtar","vatr","avtr"] ghci>