eugene-eeo / rope

ropes for golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

import "github.com/eugene-eeo/rope"

Implements the Rope data structure for Go. A Rope is a heavyweight string that can make O(n) operations such as concatenation cheaper. This package supports concatenation, splitting, indexing, and rebalancing. Mainly an exercise in making the most of Go's tooling ecosystem, therefore not Production Ready™. Example usage:

package main

import "fmt"
import "github.com/eugene-eeo/rope"

func main() {
    t := rope.L("Hello").Concat(rope.L("John!"))
    l, r := t.SplitAt(t.Index(byte("J")))
    t = rope.Concat(l, rope.L(" there, "), r)
    fmt.Println(t.Value()) // => "Hello there, John!"
}

About

ropes for golang


Languages

Language:Go 100.0%