--- Fri Jan 27 08:00:30 CST 2017
foo (x,y) = x+y
listHead [] = [] -- my own interpretation of "Head"
listHead (x:xs) = x
listTail (l:ls) = ls
myDrop _ [] = []
myDrop i ls | i == 0 = ls
| i > 0 = myDrop (i-1) (tail ls)
| True = ls
list1 = ["hello", "world", "!"]
list2 = [True, True, False]
list3 = [1..3]
addStop s = s++"."
myMap f [] = []
myMap f (x:xs) = (f x):(myMap f xs)
doubler' f x = f (f x) -- I can do doubler' addStop "test",
-- but not doubler' doubler' addStop "test"
-- (yet)
{-
trip = zip3
-}
{-
trip [] [] [] = []
trip xs ys zs = (head xs, head ys, head zs):trip (tail xs) (tail ys) (tail zs)
-}
trip [] _ _ = []
trip (x:xs) (y:ys) (z:zs) = (x, y, z):trip xs ys zs
sqr x = x^2
f100 = map sqr [0..99]
g100 = [ sqr x | x <- [0..99] ]
odd100 = [ sqr x | x <- [0..99], x `mod` 2 == 1 ]
odd100' = [ x^2 | x <- [0..99], x `mod` 2 == 1 ]
f100' = map (\x -> x^2)[0..99]
comp2 ls = [ x | x <- ls, length(x) > 3 ]
comp3 ls ms = [ (x,y) | x <- ls, y <- ms ]
{-
tripLC xs ys zs = [ (x,y,z) | x <- xs, y <- ys, z <- zs ]
Not quite, because it does the Cartesian Product of lists
-}
tripLC' xs ys zs = [ (xs!!i,ys!!i,zs!!i) | i <- [0..((length xs)-1)] ]