[Haskell-cafe] Links into list

Twan van Laarhoven twanvl at gmail.com
Mon May 2 13:46:33 CEST 2011


On 02/05/11 13:10, John Sneer wrote:
> Simply: I would like to have direct access into several places
> in a very long list.

Maybe you could use a zipper. Or just maintain the list split into 
chunks. So l' = [stuffBefore,hi,stuffAfter].
Or if you want to be able to use each element of hi as a kind of 
pointer, then l'=[stuffBefore] ++ map (:[]) hi ++ [stuffAfter]
Now modification becomes just a matter of replacing the appropriate chunk.


Twan



More information about the Haskell-Cafe mailing list