[Haskell] Looking for a random-access sequence data structure
duncan.coutts at worc.ox.ac.uk
Fri Jan 13 21:13:48 EST 2006
On Fri, 2006-01-13 at 20:52 +0000, Ross Paterson wrote:
> On Fri, Jan 13, 2006 at 08:25:46PM +0000, Duncan Coutts wrote:
> > On Fri, 2006-01-13 at 13:53 +0000, Ross Paterson wrote:
> > > Have a look at Data.Sequence (in CVS/darcs version), docs at
> > >
> > > http://www.haskell.org/ghc/dist/current/docs/libraries/base/Data-Sequence.html
> > [...]
> > It's probably too much to ask, but here's a question:
> > would it be possible to provide an operation that gives a left or right
> > view from looking up an index. Say:
> > viewrFromIndex :: Seq a -> Int -> ViewL a
> > viewlFromIndex :: Seq a -> Int -> ViewR a
> > The library currently provides views for the each end of the sequence.
> > viewl :: Seq a -> ViewL a
> > viewr :: Seq a -> ViewR a
> > I suppose this would be a zipper-like iterator for the sequence?
> I'm not entirely sure what these are intended to do, but can't you
> just compose view[lr] with take/drop?
Oh yes, so you can. That's very neat. Thanks.
More information about the Haskell