<commit_before>package sparse

type BoolSlice struct {
	m     []int64
	msize int64
	size  int64
}

func NewBoolSlice() *BoolSlice {
	return &BoolSlice{
		m:     make([]int64, 1),
		msize: 1,
	}
}

func (bs *BoolSlice) Size() int64 {
	return bs.size
}

func (bs *BoolSlice) Get(idx int64) (v bool) {
	var i, cursor int64

	for ; i < bs.msize; i++ {
		cursor += bs.m[i]
		if idx < cursor {
			return
		}
		v = !v
	}

	return
}

func (bs *BoolSlice) Set(i int64, v bool) {
	// TODO
}

func (bs *BoolSlice) Append(v bool) {
	if (bs.msize&1 == 0) == v {
		bs.m[bs.msize]++
	} else {
		bs.m = append(bs.m, 1)
		bs.msize++
	}
	bs.size++
}

func BoolSliceFromSlice(s []bool) *BoolSlice {
	var idx, msize int64
	var currval bool

	msize = 1

	slen := len(s)

	for i := 0; i < slen; i++ {
		if s[i] != currval {
			msize++
			currval = !currval
		}
	}

	bs := &BoolSlice{
		m:     make([]int64, msize),
		msize: msize,
		size:  int64(slen),<commit_msg>BoolSlice#Append: index error fixed<commit_after>package sparse

type BoolSlice struct {
	m     []int64
	msize int64
	size  int64
}

func NewBoolSlice() *BoolSlice {
	return &BoolSlice{
		m:     make([]int64, 1),
		msize: 1,
	}
}

func (bs *BoolSlice) Size() int64 {
	return bs.size
}

func (bs *BoolSlice) Get(idx int64) (v bool) {
	var i, cursor int64

	for ; i < bs.msize; i++ {
		cursor += bs.m[i]
		if idx < cursor {
			return
		}
		v = !v
	}

	return
}

func (bs *BoolSlice) Set(i int64, v bool) {
	// TODO
}

func (bs *BoolSlice) Append(v bool) {
	if (bs.msize&1 == 0) == v {
		bs.m[bs.msize-1]++
	} else {
		bs.m = append(bs.m, 1)
		bs.msize++
	}
	bs.size++
}

func BoolSliceFromSlice(s []bool) *BoolSlice {
	var idx, msize int64
	var currval bool

	msize = 1

	slen := len(s)

	for i := 0; i < slen; i++ {
		if s[i] != currval {
			msize++
			currval = !currval
		}
	}

	bs := &BoolSlice{
		m:     make([]int64, msize),
		msize: msize,
		size:  int64(slen),
{'fraction_non_alphanumeric': 0.1640461215932914, 'fraction_numerical': 0.030922431865828093, 'mean_word_length': 2.7652859960552267, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2428661', 'n_tokens_mistral': 942, 'n_tokens_neox': 849, 'n_words': 226}