This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: text buffers



> Is there an effective way to implement text buffers in guile? 
> Unlike standard strings, text buffers should not make it expensive to
> insert and delete characters from the string. I guess logarithmic cost
> for insertion, deletion and looking up of a certain position in the buffer
> might be the best one could get in theory. 
> Would it be better to implement buffers as smobs or on Scheme Level?
> Do shared substrings help in this context?

You could use a gap buffer structure, like the one Emacs uses, and use
the substring-move-left! and substring-move-right! primitives to
implement gap motion.

It could certainly be done in C as well.