[Haskell-cafe] Links into list

2011-05-02 Thread John Sneer
Hello all, I have rather strange question. I wonder whether there is an obvious solution or not in Haskell. I tried but without defining quite ugly tree-like structures and incorporating IORefs it seems to me like impossible. Note: I use ASCII art to explain. let l be a Haskell list

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Ivan Lazar Miljenovic
On 2 May 2011 11:10, John Sneer johnsn...@operamail.com wrote: Hello all,  I have rather strange question. I wonder whether there is an obvious solution or not in Haskell. I tried but without defining quite ugly tree-like structures and incorporating IORefs it seems to me like impossible.

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Felipe Almeida Lessa
On Mon, May 2, 2011 at 8:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: On 2 May 2011 11:10, John Sneer johnsn...@operamail.com wrote: Hello all,  I have rather strange question. I wonder whether there is an obvious solution or not in Haskell. I tried but without defining quite

Re: [Haskell-cafe] Links into list

2011-05-02 Thread John Sneer
Well, I have more or less similar solution, but its efficiency for map/foldr etc. is quite low :-( Nevertheless, probably no other solution. BR and thanks John -- John Sneer johnsn...@operamail.com On Mon, 02 May 2011 08:32 -0300, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Ivan Lazar Miljenovic
Re-CCing the list. On 2 May 2011 11:33, John Sneer johnsn...@operamail.com wrote: I took a look at http://cvs.haskell.org/Hugs/pages/libraries/base/Data-Sequence.html but it doesn't seem to be helpful - cannot insert sequence into the sequence, just modification of a single element is

Re: [Haskell-cafe] Links into list

2011-05-02 Thread Twan van Laarhoven
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