News for hackers. Stuff that matters.
Re:Rope (data structure) by philsnow on Saturday June 08, 2013 @02:05PM (#5845656)
I guess if you have an array of characters and you want to insert into the middle, you could promote the array into a rope as follows:

  1. break the array into two extents (start address / length pairs)
  2. make a rope out of those two extents
  3. do the insert on the resulting rope
this assumes that you're okay with starting with an array of characters and ending up with a rope.

ISTR this pattern was common-ish in erlang last time I looked at erlang, but they call ropes (of bytes) "iolists", and support for iolists goes all the way down into the standard library.

Re:Rope (data structure) by Cthulhu_ on Saturday June 08, 2013 @08:32PM (#5846932)
> this assumes that you're okay with starting with an array of characters and ending up with a rope.

Well, in any OO language, I guess both a string and a rope would still be considered a String object, whether it's a character array or a tree-like structure backing it wouldn't really matter to the public interface.