[Haskell-cafe] Application of iterate
Vincent Kraeutler
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))
>>>
>
> http://darcs.haskell.org/htam/src/Numerics/ZeroFinder/Newton.hs
>
> with
> 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 :)
>>
>
>
> http://darcs.haskell.org/htam/src/Numerics/Sequence.hs
>
> 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
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
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.
cheers,
v.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
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
mailing list