[Haskell-cafe] "translating" recursively defined sequence
Bob Ippolito
bob at redivi.com
Tue Mar 5 06:36:46 CET 2013
I suppose it depends on your definition of straightforward but you can use
the iterate function from Data.List to quickly define sequences like this.
a = iterate (\x -> (1/5) * (x**2)) 10
On Mon, Mar 4, 2013 at 9:19 PM, Christopher Howard <
christopher.howard at frigidcode.com> wrote:
> Hi. My Haskell is (sadly) getting a bit rusty. I was wondering what
> would be the most straightforward and easily followed "procedure" for
> translating a recursively defined sequence into a Haskell function. For
> example, this one from a homework assignment.
>
> quote:
> --------
> a_1 = 10
> a_(k+1) = (1/5) * (a_k)**2
> --------
>
> (The underscore is meant to represent subscripting what follows it.)
>
> --
> frigidcode.com
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130304/570d8eca/attachment.htm>
More information about the Haskell-Cafe
mailing list