<commit_before>(function (define) {
    define('ceylon.language', function (require, exports) {

//the Ceylon language module
function print(line) { console.log(line.getString().value) }

CeylonObject=function CeylonObject() {}

CeylonObject.prototype.getString=function() { String(Object.prototype.toString.apply(this)) };
CeylonObject.prototype.toString=function() { return this.getString().value };

//TODO: we need to distinguish between Objects and IdentifiableObjects
CeylonObject.prototype.equals = function(other) { return Boolean(this===other) }

function $Integer() {}
function Integer(value) {
    var that = new $Integer;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$Integer.prototype[$]=CeylonObject.prototype[$]}
$Integer.prototype.getString = function() { return String(this.value.toString()) }
$Integer.prototype.plus = function(other) { return Integer(this.value+other.value) }
$Integer.prototype.minus = function(other) { return Integer(this.value-other.value) }
$Integer.prototype.times = function(other) { return Integer(this.value*other.value) }
$Integer.prototype.divided = function(other) {
    var exact = this.value/other.value;
    return Integer((exact<0) ? Math.ceil(exact) : Math.floor(exact));
}
$Integer.prototype.remainder = function(other) { return Integer(this.value%other.value) }
$Integer.prototype.power = function(other) {
    var exact = Math.pow(this.value, other.value);
    return Integer((exact<0) ? Math.ceil(exact) : Math.floor(exact));
}
$Integer.prototype.negativeValue = function() { return Integer(-this.value) }
$Integer.prototype.positiveValue = function() { return this }
$Integer.prototype.equals = function(other) { return Boolean(other.value===this.value) }
$Integer.prototype.compare = function(other) {
    return this.value===other.value ? equal
                                    : (this.value<other.value ? smaller:larger);
}
$Integer.prototype.getFloat = function() { return Float(this.value) }
$Integer.prototype.getInteger = function() { return this }
$Integer.prototype.getSuccessor = function() { return Integer(this.value+1) }
$Integer.prototype.getPredecessor = function() { return Integer(this.value-1) }

function $Float() {}
function Float(value) {
    var that = new $Float;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$Float.prototype[$]=CeylonObject.prototype[$]}
$Float.prototype.getString = function() { return String(this.value.toString()) }
$Float.prototype.plus = function(other) { return Float(this.value+other.value) }
$Float.prototype.minus = function(other) { return Float(this.value-other.value) }
$Float.prototype.times = function(other) { return Float(this.value*other.value) }
$Float.prototype.divided = function(other) { return Float(this.value/other.value) }
$Float.prototype.power = function(other) { return Float(Math.pow(this.value, other.value)) }
$Float.prototype.negativeValue = function() { return Float(-this.value) }
$Float.prototype.positiveValue = function() { return this }
$Float.prototype.equals = function(other) { return Boolean(other.value===this.value) }
$Float.prototype.compare = function(other) {
    return this.value===other.value ? equal
                                    : (this.value<other.value ? smaller:larger);
}
$Float.prototype.getFloat = function() { return this }

function $String() {}
function String(value) {
    var that = new $String;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$String.prototype[$]=CeylonObject.prototype[$]}
$String.prototype.getString = function() { return this }
$String.prototype.toString = function() { return this.value }
$String.prototype.plus = function(other) { return String(this.value+other.value) }
$String.prototype.equals = function(other) { return Boolean(other.value===this.value) }
$String.prototype.compare = function(other) {
    return this.value===other.value ? equal
                                    : (this.value<other.value ? smaller:larger);
}
$String.prototype.getUppercased = function() { return String(this.value.toUpperCase()) }
$String.prototype.getLowercased = function() { return String(this.value.toLowerCase()) }

function $Case() {}
function Case(caseName) {
    var that = new $Case;
    that.string = String(caseName);
    return that;
}
for(var $ in CeylonObject.prototype){$Case.prototype[$]=CeylonObject.prototype[$]}
$Case.prototype.getString = function() { return this.string }

function getNull() { return null }
var $true = Case("true");
function getTrue() { return $true; }
var $false = Case("false");
function getFalse() { return $false; }
function Boolean(value) {
    return value ? $true : $false;
}

//These are operators for handling nulls
function exists(value) { return value === getNull() ? getFalse() : getTrue(); }
function nonempty(value) { return value && value.value && value.value.length > 0 ? getTrue() : getFalse(); }

var larger = Case("larger");
function getLarger() { return larger }
var smaller = Case("smaller");
function getSmaller() { return smaller }
var equal = Case("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 }

function $ArraySequence() {}
function ArraySequence(value) {
    var that = new $ArraySequence;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$ArraySequence.prototype[$]=CeylonObject.prototype[$]}
$ArraySequence.prototype.getString = function() { return String(this.value.toString()) }
$ArraySequence.prototype.item = function(index) {
    var result = this.value[index.value];
    return result!==undefined ? result:null;
}
$ArraySequence.prototype.getSize = function() { return Integer(this.value.length) }

function $Range() {}
function Range(first, last) {
    var that = new $Range;
    that.first = first;
    that.last = last;
    var index = 0;
    var x = first;
    var dec = first.compare(last) === larger;
    while (x.equals(last) === getFalse()) { //some replicated code because we don't yet have the functions here
        index++;
        x = dec ? x.getPredecessor() : x.getSuccessor();
    }
    that.size = Integer(index+1);
    return that;
}
for(var $ in CeylonObject.prototype){$Range.prototype[$]=CeylonObject.prototype[$]}
$Range.prototype.getFirst = function() { return this.first; }
$Range.prototype.getLast = function() { return this.last; }
$Range.prototype.getDecreasing = function() {
    return this.first.compare(this.last) === larger ? getTrue() : getFalse();
}
$Range.prototype.next = function(x) {
    return this.getDecreasing() === getTrue() ? x.getPredecessor() : x.getSuccessor();
}
$Range.prototype.getSize = function() { return this.size; }
$Range.prototype.item = function(index) {
    var idx = 0;
    var x = this.first;
    while (idx < index.value) {
        if (x.equals(this.last) === getTrue()) { return getNull(); }
        else {
            idx++;
            x = this.next(x);
        }
    }
    return x;
}
$Range.prototype.includes = function(x) {
    var compf = x.compare(this.first);
    var compl = x.compare(this.last);
    var rval = this.getDecreasing() === getTrue() ? ((compf === equal || compf === smaller) && (compl === equal || compl === larger)) : ((compf === equal || compf === larger) && (compl === equal || compl === smaller));
    return rval ? getTrue() : getFalse();
}
$Range.prototype.contains = $Range.prototype.includes;
$Range.prototype.getString = function() { return String(this.first.getString().value + ".." + this.last.getString().value); }
$Range.prototype.equals = function(other) {
    var eqf = this.first.equals(other.getFirst());
    var eql = this.last.equals(other.getLast());
    return (eqf === getTrue() && eql === getTrue()) ? getTrue() : getFalse();
}

function $Singleton() {}
function Singleton(elem) {
    var that = new $Singleton;
    that.value = [elem];
    return that;
}
for(var $ in CeylonObject.prototype){$Singleton.prototype[$]=CeylonObject.prototype[$]}
$Singleton.prototype.getString = function() { return String(this.value.toString()) }
$Singleton.prototype.item = function(index) {
    return index.value===0 ? this.value[0] : null;
}
$Singleton.prototype.getSize = function() { return Integer(1) }

function $Entry() {}
function Entry(key, item) {<commit_msg>Add Range.by, Range.lastIndex and Range.rest<commit_after>(function (define) {
    define('ceylon.language', function (require, exports) {

//the Ceylon language module
function print(line) { console.log(line.getString().value) }

CeylonObject=function CeylonObject() {}

CeylonObject.prototype.getString=function() { String(Object.prototype.toString.apply(this)) };
CeylonObject.prototype.toString=function() { return this.getString().value };

//TODO: we need to distinguish between Objects and IdentifiableObjects
CeylonObject.prototype.equals = function(other) { return Boolean(this===other) }

function $Integer() {}
function Integer(value) {
    var that = new $Integer;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$Integer.prototype[$]=CeylonObject.prototype[$]}
$Integer.prototype.getString = function() { return String(this.value.toString()) }
$Integer.prototype.plus = function(other) { return Integer(this.value+other.value) }
$Integer.prototype.minus = function(other) { return Integer(this.value-other.value) }
$Integer.prototype.times = function(other) { return Integer(this.value*other.value) }
$Integer.prototype.divided = function(other) {
    var exact = this.value/other.value;
    return Integer((exact<0) ? Math.ceil(exact) : Math.floor(exact));
}
$Integer.prototype.remainder = function(other) { return Integer(this.value%other.value) }
$Integer.prototype.power = function(other) {
    var exact = Math.pow(this.value, other.value);
    return Integer((exact<0) ? Math.ceil(exact) : Math.floor(exact));
}
$Integer.prototype.negativeValue = function() { return Integer(-this.value) }
$Integer.prototype.positiveValue = function() { return this }
$Integer.prototype.equals = function(other) { return Boolean(other.value===this.value) }
$Integer.prototype.compare = function(other) {
    return this.value===other.value ? equal
                                    : (this.value<other.value ? smaller:larger);
}
$Integer.prototype.getFloat = function() { return Float(this.value) }
$Integer.prototype.getInteger = function() { return this }
$Integer.prototype.getSuccessor = function() { return Integer(this.value+1) }
$Integer.prototype.getPredecessor = function() { return Integer(this.value-1) }

function $Float() {}
function Float(value) {
    var that = new $Float;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$Float.prototype[$]=CeylonObject.prototype[$]}
$Float.prototype.getString = function() { return String(this.value.toString()) }
$Float.prototype.plus = function(other) { return Float(this.value+other.value) }
$Float.prototype.minus = function(other) { return Float(this.value-other.value) }
$Float.prototype.times = function(other) { return Float(this.value*other.value) }
$Float.prototype.divided = function(other) { return Float(this.value/other.value) }
$Float.prototype.power = function(other) { return Float(Math.pow(this.value, other.value)) }
$Float.prototype.negativeValue = function() { return Float(-this.value) }
$Float.prototype.positiveValue = function() { return this }
$Float.prototype.equals = function(other) { return Boolean(other.value===this.value) }
$Float.prototype.compare = function(other) {
    return this.value===other.value ? equal
                                    : (this.value<other.value ? smaller:larger);
}
$Float.prototype.getFloat = function() { return this }

function $String() {}
function String(value) {
    var that = new $String;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$String.prototype[$]=CeylonObject.prototype[$]}
$String.prototype.getString = function() { return this }
$String.prototype.toString = function() { return this.value }
$String.prototype.plus = function(other) { return String(this.value+other.value) }
$String.prototype.equals = function(other) { return Boolean(other.value===this.value) }
$String.prototype.compare = function(other) {
    return this.value===other.value ? equal
                                    : (this.value<other.value ? smaller:larger);
}
$String.prototype.getUppercased = function() { return String(this.value.toUpperCase()) }
$String.prototype.getLowercased = function() { return String(this.value.toLowerCase()) }

function $Case() {}
function Case(caseName) {
    var that = new $Case;
    that.string = String(caseName);
    return that;
}
for(var $ in CeylonObject.prototype){$Case.prototype[$]=CeylonObject.prototype[$]}
$Case.prototype.getString = function() { return this.string }

function getNull() { return null }
var $true = Case("true");
function getTrue() { return $true; }
var $false = Case("false");
function getFalse() { return $false; }
function Boolean(value) {
    return value ? $true : $false;
}

//These are operators for handling nulls
function exists(value) { return value === getNull() ? getFalse() : getTrue(); }
function nonempty(value) { return value && value.value && value.value.length > 0 ? getTrue() : getFalse(); }

var larger = Case("larger");
function getLarger() { return larger }
var smaller = Case("smaller");
function getSmaller() { return smaller }
var equal = Case("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 }

function $ArraySequence() {}
function ArraySequence(value) {
    var that = new $ArraySequence;
    that.value = value;
    return that;
}
for(var $ in CeylonObject.prototype){$ArraySequence.prototype[$]=CeylonObject.prototype[$]}
$ArraySequence.prototype.getString = function() { return String(this.value.toString()) }
$ArraySequence.prototype.item = function(index) {
    var result = this.value[index.value];
    return result!==undefined ? result:null;
}
$ArraySequence.prototype.getSize = function() { return Integer(this.value.length) }

function $Range() {}
function Range(first, last) {
    var that = new $Range;
    that.first = first;
    that.last = last;
    var index = 0;
    var x = first;
    var dec = first.compare(last) === larger;
    while (x.equals(last) === getFalse()) { //some replicated code because we don't yet have the functions here
        index++;
        x = dec ? x.getPredecessor() : x.getSuccessor();
    }
    that.size = Integer(index+1);
    return that;
}
for(var $ in CeylonObject.prototype){$Range.prototype[$]=CeylonObject.prototype[$]}
$Range.prototype.getFirst = function() { return this.first; }
$Range.prototype.getLast = function() { return this.last; }
$Range.prototype.getDecreasing = function() {
    return this.first.compare(this.last) === larger ? getTrue() : getFalse();
}
$Range.prototype.next = function(x) {
    return this.getDecreasing() === getTrue() ? x.getPredecessor() : x.getSuccessor();
}
$Range.prototype.getSize = function() { return this.size; }
$Range.prototype.getLastIndex = function() { return Integer(this.size-1); }
$Range.prototype.item = function(index) {
    var idx = 0;
    var x = this.first;
    while (idx < index.value) {
        if (x.equals(this.last) === getTrue()) { return getNull(); }
        else {
            idx++;
            x = this.next(x);
        }
    }
    return x;
}
$Range.prototype.includes = function(x) {
    var compf = x.compare(this.first);
    var compl = x.compare(this.last);
    var rval = this.getDecreasing() === getTrue() ? ((compf === equal || compf === smaller) && (compl === equal || compl === larger)) : ((compf === equal || compf === larger) && (compl === equal || compl === smaller));
    return rval ? getTrue() : getFalse();
}
$Range.prototype.contains = $Range.prototype.includes;
$Range.prototype.getRest = function() {
    var n = this.next(this.first);
    return (n.equals(this.last) === getTrue()) ? ArraySequence([]) : Range(n, this.last);
}
$Range.prototype.by = function(step) {
    if (step.compare(Integer(0)) !== larger) {
        //throw
    }
    if (this.first.equals(this.last) === getTrue() || step.equals(Integer(1)) === getTrue()) {
console.log("devolvemos mismo rango porque ", this.first.getString().value, this.last.getString().value, step.value);
        return this;
    }
    var seq = [];
    var x = this.first;
    while (this.includes(x) === getTrue()) {
        seq.push(x);
        for (var i = 0; i < step.value; i++) { x = this.next(x); }
    }
    return ArraySequence(seq);
}
$Range.prototype.getString = function() { return String(this.first.getString().value + ".." + this.last.getString().value); }
$Range.prototype.equals = function(other) {
    var eqf = this.first.equals(other.getFirst());
    var eql = this.last.equals(other.getLast());
    return (eqf === getTrue() && eql === getTrue()) ? getTrue() : getFalse();
}

function $Singleton() {}
function Singleton(elem) {
    var that = new $Singleton;
    that.value = [elem];
    return that;
}
for(var $ in CeylonObject.prototype){$Singleton.prototype[$]=CeylonObject.prototype[$]}
$Singleton.prototype.getString = function() { return String(this.value.toString()) }
$Singleton.prototype.item = function(index) {
    return index.value===0 ? this.value[0] : null;
}
$Singleton.prototype.getSize = function() { return Integer(1) }

function $Entry() {}
function Entry(key, item) {
{'fraction_non_alphanumeric': 0.1629755820556502, 'fraction_numerical': 0.0014764338444065873, 'mean_word_length': 4.312518853695324, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3305458', 'n_tokens_mistral': 5301, 'n_tokens_neox': 5223, 'n_words': 1157}