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.
G'day all.
Quoting Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED]:
2. Use a persistent data structure with logarithmic cost of most
operations: a balanced tree of text fragments, called a rope
(Hans Boehm has made one for C). Undo can be made by simply
keeping old versions.
Hard
In the case of writing something like a text editor where the data
involved is by its very nature mutable, what sort of design paradigm
would you use in a functional language?
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
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 ...
so a document may look like:
[Insert 0 Hello World, Delete 6 10, Insert \n World]
But you will
I imagine you would want to use a truly mutable data structure in the IO
monad -- something like an STUArray of Chars.
GoldPython wrote:
In the case of writing something like a text editor where the data
involved is by its very nature mutable, what sort of design paradigm
would you use in a
GoldPython [EMAIL PROTECTED] writes:
In the case of writing something like a text editor where the data
involved is by its very nature mutable, what sort of design paradigm
would you use in a functional language?
This is specific to text editors:
1. Use a traditional mutable data structure,
GoldPython wrote:
In the case of writing something like a text editor where the data
involved is by its very nature mutable, what sort of design paradigm
would you use in a functional language?
I wouldn't say that textual data is by its nature mutable. That's just
the imperative way of looking at
Keean Schupke [EMAIL PROTECTED] writes:
What happens with this method when the display needs refreshing, does
the current state have to be recomputed every time ...
No. The new state is constructed from bits of old state and the
changed data. Applying a change on average requires logarithmic
I'm going to take by your replies that you've never worked for a major
corporation. :)
Thats okay. Cause unless you've really been in the grind of their
operations it can seem irrational from the outside
I'm giving examples of the difficulties that would be faced in
attempting to get managers
I have the same experience. I wish it wasn't so, but it is.
I've been playing with Haskell since before Haskell 98, and until I
joined this email list a couple weeks ago, I had never met another
human being that knew what functional programming was much less had
done any. I've been working around
On 2004 December 03 Friday 15:16, GoldPython wrote:
until I joined this email list a couple weeks ago, I had never met another
human being that knew what functional programming was
My experience has been different in Massachusetts. At my first job after my
Comp Sci degree, developing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 3 déc. 04, at 17:28, GoldPython wrote:
In the case of writing something like a text editor where the data
involved is by its very nature mutable, what sort of design paradigm
would you use in a functional language?
Maybe you should take a look at Yi
12 matches
Mail list logo