filterButLast f (x:xs)
    | f x = x : filterButLast f xs
    | otherwise = filterButLast f xs
filterButLast f (x:xs)
    | f x = x : filterButLast f xs
    | otherwise = filterButLast f xs
filterButLast f (x:xs)
    | f x = x : filterButLast f xs
    | otherwise = filterButLast f xs