[Haskell-cafe] Application of iterate
vincent at kraeutler.net
Fri Mar 23 12:38:30 EDT 2007
Henning Thielemann wrote:
> On Fri, 23 Mar 2007, Neil Mitchell wrote:
>>> my_sqrt t = last (take 20 (iterate (\n -> n/2 + t/(2 * n)) t))
> inverse t (\x->(x^2,2*x)) t
>> I don't know how to add it into the one liner though - although I
>> suspect someone here will :)
> limitDifference :: (Real a) => a -> [a] -> a
> limitDifference tol xs =
> case dropWhile ((> tol) . abs . uncurry (-)) $ zip xs (tail xs) of
> ((_,x):_) -> x
>  -> error "limitDifference: Finite sequence, but no element satisfies abort criterion."
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
as a fellow haskell newbie, i would like to take this opportunity to
encourage library authors to submit their material to the haskell hackage.
the haskell infrastructure is rather big, complex and "organic". (see
e.g. http://darcs.haskell.org/tmp/ for an example) it was only by chance
that i ran across the (rather amazing) htam library a week ago or so. i
hope you agree that these things should not be left to chance ;-)
hoogle, google and hackage tend to be the first places where i look for
fresh meat. i suppose this also applies to other haskell freshmen.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070323/1d3997e3/signature.bin
More information about the Haskell-Cafe