-- FP1 lab exercises 4   14 March 2011


-- 1.

type Dict = [(String,String)]

d :: Dict
d =     [("apple","pomme"),
         ("bread","pain"),
         ("butter","beurre"),
         ("car","voiture"),
         ("day","jour"),
         ("milk","lait"),
         ("moon","lune"),
         ("no","non"),
         ("nuit","night"),
         ("one","un"),
         ("one","une"),
         ("sun","soleil"),
         ("three","trois"),
         ("train","train"),
         ("two","deux"),
         ("yes","oui")]

getF :: Dict -> String -> Dict  
getF d w = [ (e,f) | (e,f) <- d, w == e]

isinit :: String -> String -> Bool
isinit s1 s2 = l1 <= l2 && and [s1 !! i == s2 !! i | i <- [0..(l1-1)]]

  where  l1 = length s1
         l2 = length s2  



