walk :: Int -> Int -> (Int -> Bool) -> Int
walk start stop f | start == stop = 0
walk start stop f = 1 + walk (if f start then start + 1 else start - 1) stop f
