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 +-+-+-------------------------------------+ l = | | | .... | +-+-+-------------------------------------+ let li be another Haskell list +-+-+-+ li = |a|b|c| +-+-+-+ let hi be a hook/pointer list such, that it links some/all members of the list li +--+--+--+ hi = |pa|pb|pc| +--+--+--+ | | | V V V +--+--+--+ li = |a |b |c | +--+--+--+ When I insert li into l, I would like to get something like: +--+--+--+ hi = |pa|pb|pc| +--+--+--+ | | | V V V +-+-+----------+--+--+--+---------------------------+ l' = | | | .... |a |b |c | | +-+-+----------+--+--+--+---------------------------+ where l' is still a Haskell list. Now, I would like to modify, directly via pb the list l' to have: +--+--+--+ hi = |pa|pb|pc| +--+--+--+ | | +-------+ V V V +-+-+----------+--+--+-+-+-+-+--+---------------------------+ le = | | | .... |a |b |q|w|e|r|c | | +-+-+----------+--+--+-+-+-+-+--+---------------------------+ where le is a Haskell list, but, in fact accessible through the same ID/reference all the time. Simply: I would like to have direct access into several places in a very long list. Moreover, the efficiency and features of Haskell list and all the functions around it are to be used as well (not all, but many, nevertheless, I could make them new, if I can achieve good performance, not a big trouble). Is it possible, or not? Could you possibly point me to some resource I can get more information about such "tricks". Thanks John -- John Sneer johnsn...@operamail.com -- http://www.fastmail.fm - A no graphics, no pop-ups email service _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe