[Haskell-cafe] [Haskell] Function to replace given element in list

amindfv at gmail.com amindfv at gmail.com
Wed Jul 20 00:21:12 UTC 2016


(Moving to haskell-cafe@ -- haskell@ is only for announcements)


> El 19 jul 2016, a las 19:44, David Feuer <david.feuer at gmail.com> escribió:
> 
> A zipper is a good way to separate the search from the replacement. But the problem at hand does not require such a separation! If you don't need that, a zipper seems like overkill.
> 
> 
> On Jul 19, 2016 7:39 PM, "Carl Folke Henschen Edman" <carledman at gmail.com> wrote:
> On Tue, Jul 19, 2016 at 6:13 PM, David Feuer <david.feuer at gmail.com> wrote:
>> Using a zipper will not get you very far here. The best way would
>> likely be to replace the list with a balanced search tree. 
> 
> 
> That depends on the pattern of access and usage.  For some a zippered list will outperform a self-balancing tree and vice versa.  For others a zippered tree, or something else, will beat either.  But when seeing the pattern of changing a single element in the middle of a list, a zippered list is the first improved data structure that comes to mind.
> 
> 
>     Carl Edman
> 
> _______________________________________________
> Haskell mailing list
> Haskell at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160719/107f7347/attachment.html>


More information about the Haskell-Cafe mailing list