Guest User

MastaP

a guest
Jan 21st, 2010
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lastrev rs b = snd $ maximum [(lst r r, r) | r <- rs, take (length b) r == b] where
  2.     lst [] rest = read rest :: Int
  3.     lst (x:xs) rest = if x /= '.' then lst xs rest else lst xs xs
  4.  
  5. --*Main> lastrev ["1.3.2.1", "1.3.2.4", "1.3.4.1", "1.3.2.1.2.4", "1.3.2.1.2.30"] "1.3.2.1"            
  6. --"1.3.2.1.2.30"
RAW Paste Data