<commit_before>var exports,console,$true,$false,$finished,process$,$empty;//IGNORE
function Comparison(x){}//IGNORE
function ArraySequence(x){}//IGNORE
function Entry(a,b){}//IGNORE
function Singleton(x){}//IGNORE
function SequenceBuilder(){}//IGNORE
function Integer(x){}//IGNORE
function Boolean$(f){}//IGNORE
function String$(f,x){}//IGNORE

function print(line) { process$.writeLine(line.getString()); }
exports.print=print;

var larger = Comparison("larger");
function getLarger() { return larger }
var smaller = Comparison("smaller");
function getSmaller() { return smaller }
var equal = Comparison("equal");
function getEqual() { return equal }
function largest(x, y) { return x.compare(y) === larger ? x : y }
function smallest(x, y) { return x.compare(y) === smaller ? x : y }

exports.getLarger=getLarger;
exports.getSmaller=getSmaller;
exports.getEqual=getEqual;
exports.largest=largest;
exports.smallest=smallest;

//receives ArraySequence, returns element
function min(seq) {
    var v = seq.getFirst();
    if (v === null) return null;
    var iter = seq.getRest().getIterator();
    var e; while ((e = iter.next()) !== $finished) {
        v = smallest(v, e);
    }
    return v;
}
//receives ArraySequence, returns element 
function max(/*ContainerWithFirstElement*/seq) {
    var v = seq.getFirst();
    if (v === null) return null;
    var iter = seq.getRest().getIterator();
    var e; while ((e = iter.next()) !== $finished) {
        v = largest(v, e);
    }
    return v;
}
//receives ArraySequence of ArraySequences, returns flat ArraySequence
function join(seqs) {
    if (seqs === undefined) return $empty;
    var builder = [];
    var it = seqs.getIterator();
    var seq;
    while ((seq = it.next()) !== $finished) {
        var it2 = seq.getIterator();
        var elem;
        while ((elem = it2.next()) != $finished) {builder.push(elem);}
    }
    return ArraySequence(builder);
}
//receives ArraySequences, returns ArraySequence
function zip(keys, items) {
    var entries = []
    var numEntries = Math.min(keys.value.length, items.value.length);
    for (var i = 0; i < numEntries; i++) {
        entries[i] = Entry(keys.value[i], items.value[i]);
    }
    return ArraySequence(entries);
}
//receives and returns ArraySequence
function coalesce(seq) {
    if (seq === undefined) {return $empty}
    return seq.getCoalesced();
}

//receives ArraySequence and CeylonObject, returns new ArraySequence
function append(seq, elem) {
    return ArraySequence(seq.value.concat(elem));
}
function prepend(seq, elem) {
    if (seq.getEmpty() === $true) {
        return Singleton(elem);
    } else {
        var sb = SequenceBuilder();
        sb.append(elem);
        sb.appendAll(seq);
        return sb.getSequence();
    }
}

//Receives Iterable, returns ArraySequence (with Entries)
function entries(seq) {
    if (seq === undefined) return $empty;
    return seq.getIndexed();
}

function any(/*Boolean...*/ values) {
    if (values === undefined) return $false;
    var it = values.getIterator();
    var v;
    while ((v = it.next()) !== $finished) {
        if (v === $true) {return $true;}
    }
    return $false;
}
function every(/*Boolean...*/ values) {
    if (values === undefined) return $false;
    var it = values.getIterator();
    var v;
    while ((v = it.next()) !== $finished) {
        if (v === $false) {return $false;}
    }
    return $true;
}

function first(/*Element...*/ elements) {
    if (elements === undefined) return null;
    var e = elements.getIterator().next();
    return (e !== $finished) ? e : null;
}

exports.min=min;
exports.max=max;
exports.join=join;
exports.zip=zip;
exports.coalesce=coalesce;
exports.append=append;
exports.prepend=prepend;
exports.entries=entries;<commit_msg>Add sum() function<commit_after>var exports,console,$true,$false,$finished,process$,$empty;//IGNORE
function Comparison(x){}//IGNORE
function ArraySequence(x){}//IGNORE
function Entry(a,b){}//IGNORE
function Singleton(x){}//IGNORE
function SequenceBuilder(){}//IGNORE
function Integer(x){}//IGNORE
function Boolean$(f){}//IGNORE
function String$(f,x){}//IGNORE

function print(line) { process$.writeLine(line.getString()); }
exports.print=print;

var larger = Comparison("larger");
function getLarger() { return larger }
var smaller = Comparison("smaller");
function getSmaller() { return smaller }
var equal = Comparison("equal");
function getEqual() { return equal }
function largest(x, y) { return x.compare(y) === larger ? x : y }
function smallest(x, y) { return x.compare(y) === smaller ? x : y }

exports.getLarger=getLarger;
exports.getSmaller=getSmaller;
exports.getEqual=getEqual;
exports.largest=largest;
exports.smallest=smallest;

//receives ArraySequence, returns element
function min(seq) {
    var v = seq.getFirst();
    if (v === null) return null;
    var iter = seq.getRest().getIterator();
    var e; while ((e = iter.next()) !== $finished) {
        v = smallest(v, e);
    }
    return v;
}
//receives ArraySequence, returns element 
function max(/*ContainerWithFirstElement*/seq) {
    var v = seq.getFirst();
    if (v === null) return null;
    var iter = seq.getRest().getIterator();
    var e; while ((e = iter.next()) !== $finished) {
        v = largest(v, e);
    }
    return v;
}
function sum(seq) {
	var v = seq.getFirst();
	var iter = seq.getRest().getIterator();
	var e; while ((e = iter.next()) !== $finished) {
		v = v.plus(e);
	}
	return v;
}

//receives ArraySequence of ArraySequences, returns flat ArraySequence
function join(seqs) {
    if (seqs === undefined) return $empty;
    var builder = [];
    var it = seqs.getIterator();
    var seq;
    while ((seq = it.next()) !== $finished) {
        var it2 = seq.getIterator();
        var elem;
        while ((elem = it2.next()) != $finished) {builder.push(elem);}
    }
    return ArraySequence(builder);
}
//receives ArraySequences, returns ArraySequence
function zip(keys, items) {
    var entries = []
    var numEntries = Math.min(keys.value.length, items.value.length);
    for (var i = 0; i < numEntries; i++) {
        entries[i] = Entry(keys.value[i], items.value[i]);
    }
    return ArraySequence(entries);
}
//receives and returns ArraySequence
function coalesce(seq) {
    if (seq === undefined) {return $empty}
    return seq.getCoalesced();
}

//receives ArraySequence and CeylonObject, returns new ArraySequence
function append(seq, elem) {
    return ArraySequence(seq.value.concat(elem));
}
function prepend(seq, elem) {
    if (seq.getEmpty() === $true) {
        return Singleton(elem);
    } else {
        var sb = SequenceBuilder();
        sb.append(elem);
        sb.appendAll(seq);
        return sb.getSequence();
    }
}

//Receives Iterable, returns ArraySequence (with Entries)
function entries(seq) {
    if (seq === undefined) return $empty;
    return seq.getIndexed();
}

function any(/*Boolean...*/ values) {
    if (values === undefined) return $false;
    var it = values.getIterator();
    var v;
    while ((v = it.next()) !== $finished) {
        if (v === $true) {return $true;}
    }
    return $false;
}
function every(/*Boolean...*/ values) {
    if (values === undefined) return $false;
    var it = values.getIterator();
    var v;
    while ((v = it.next()) !== $finished) {
        if (v === $false) {return $false;}
    }
    return $true;
}

function first(/*Element...*/ elements) {
    if (elements === undefined) return null;
    var e = elements.getIterator().next();
    return (e !== $finished) ? e : null;
}

exports.min=min;
exports.max=max;
exports.sum=sum;
exports.join=join;
exports.zip=zip;
exports.coalesce=coalesce;
exports.append=append;
exports.prepend=prepend;
exports.entries=entries;
{'fraction_non_alphanumeric': 0.1645027265645287, 'fraction_numerical': 0.0007790184367696703, 'mean_word_length': 3.5878499106611077, 'pattern_counts': {'":': 0, '<': 5, '<?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': '889397', 'n_tokens_mistral': 2479, 'n_tokens_neox': 2430, 'n_words': 640}