[Haskell-cafe] least fixed points above something
jens.blanck at gmail.com
Thu Mar 19 05:49:18 EDT 2009
I found myself writing the following
leastFixedPoint :: (Eq a) => (a -> a) -> a -> a
leastFixedPoint f x = fst . head . dropWhile (uncurry (/=)) $ zip l (tail l)
where l = iterate f x
and was a bit surprised that I couldn't get any matches on hoogle for the
type above. The closest one is fix :: (a -> a) -> a but that sort of assumes
that we're starting the fixed point search from the bottom element
Anyway, is there a nicer way of doing the above?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe