[Haskell-cafe] Mutable data design question

Keith Wansbrough Keith.Wansbrough at cl.cam.ac.uk
Mon Dec 6 09:00:58 EST 2004


> Well, if you consider large word-processors like word keep a complete 
> undo history, I
> would keep a document as a list of changes:
> 
> data Document = Insert Location String | Delete Location Location ...

Better to store it as a pair of the most recent state, and a list of *reversed* changes.

--KW 8-)
-- 
Keith Wansbrough <kw217 at cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.



More information about the Haskell-Cafe mailing list