[Haskell-cafe] Re: [Haskell] Recursive definition of fibonacci with Data.Vector

Henning Thielemann lemming at henning-thielemann.de
Mon Mar 8 14:58:07 EST 2010


On Sun, 7 Mar 2010, Edgar Z. Alvarenga wrote:

> Hello,
>
> why I can't define a recursive vector using Data.Vector, like in
> the example:
>
> import qualified Data.Vector as V
>
> let fib = 0 `V.cons` (1 `V.cons` V.zipWith (+) fib (V.tail v))

Since I liked to have both element-wise lazy construction and packed data, 
I created a data-structure for that purpose:
   http://code.haskell.org/storablevector/Data/StorableVector/Cursor.hs
However, those vectors/arrays are finite, but could be extended to a 
chunky infinite structure.


More information about the Haskell-Cafe mailing list