<commit_before>import structs/ArrayList

Bag: class {

    // NOTE: most "real" code taken from sdk/structs/ArrayList
    data: ArrayList<Cell<Pointer>>

    init: func ~withCapacity(len: Int) {
        data = ArrayList<Cell<Pointer>> new(len)
    }

    init: func {
        init ~withCapacity(10)
    }

    add: func <T> (element: T) {
        tmp := Cell<T> new(element)
        data add(tmp)
    }

    add: func <T> ~withIndex(index: Int, element: T) {
        tmp := Cell<T> new(element)
        data add(index, tmp)
    }

    clear: func {data clear()}

    get: func <T> (index: Int, T: Class) -> T {
        tmp := data get(index)
        return tmp val
    }

    indexOf: func <T> (element: T) -> Int {
        index := -1
        while (index < data size) {
            index += 1
            candidate: T
            candidate = data get(index) val
            if(memcmp(candidate&, element&, T size) == 0) return index
        }
        return -1
    }<commit_msg>Fixed syntax error in structs/Bag.<commit_after>import structs/ArrayList

Bag: class {

    // NOTE: most "real" code taken from sdk/structs/ArrayList
    data: ArrayList<Cell<Pointer>>

    init: func ~withCapacity(len: Int) {
        data = ArrayList<Cell<Pointer>> new(len)
    }

    init: func {
        init ~withCapacity(10)
    }

    add: func <T> (element: T) {
        tmp := Cell<T> new(element)
        data add(tmp)
    }

    add: func ~withIndex <T> (index: Int, element: T) {
        tmp := Cell<T> new(element)
        data add(index, tmp)
    }

    clear: func {data clear()}

    get: func <T> (index: Int, T: Class) -> T {
        tmp := data get(index)
        return tmp val
    }

    indexOf: func <T> (element: T) -> Int {
        index := -1
        while (index < data size) {
            index += 1
            candidate: T
            candidate = data get(index) val
            if(memcmp(candidate&, element&, T size) == 0) return index
        }
        return -1
    }
{'fraction_non_alphanumeric': 0.13218970736629668, 'fraction_numerical': 0.006054490413723511, 'mean_word_length': 1.865606936416185, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '3994867', 'n_tokens_mistral': 650, 'n_tokens_neox': 630, 'n_words': 193}