<commit_before>"A possibly-empty, immutable sequence of values. The type 
 `Sequential<Element>` may be abbreviated `[Element*]` or 
 `Element[]`. 
 
 `Sequential` has two enumerated subtypes:
 
 - `Empty`, abbreviated `[]`, represents an empty sequence, 
    and
 - `Sequence<Element>`, abbreviated `[Element+]` represents 
    a non-empty sequence, and has the very important 
    subclass [[Tuple]]."
see (`class Tuple`)
shared interface Sequential<out Element>
        of []|[Element+]
        satisfies List<Element> & 
                  Ranged<Integer,Element,Element[]> {
    
    "This sequence."
    shared actual default Element[] sequence() => this;
    
    "The rest of the sequence, without the first element."
    shared actual formal Element[] rest;
    
    "A sequence containing all indexes of this sequence."
    shared actual default Integer[] keys => 0:size;
    
    shared actual formal Element[] reversed;
    
    shared actual formal Element[] reverse();
    
    "Returns a sequence formed by repeating the elements of 
     this sequence the given number of times, or an empty 
     sequence if `times<=0`."
    shared actual default Element[] repeat(Integer times)
            => [*cycle(times)];
    
    "Select the first elements of this sequence, returning 
     a sequence no longer than the given length. If this 
     sequence is shorter than the given length, return this 
     sequence. Otherwise return a sequence of the given 
     length."
    shared actual default Element[] initial(Integer length)
            => this[0:length];
    
    "Select the last elements of the sequence, returning a 
     sequence no longer than the given length. If this 
     sequence is shorter than the given length, return this 
     sequence. Otherwise return a sequence of the given 
     length."
    shared actual default Element[] terminal(Integer length) {
        if (exists l = lastIndex, length>0) {
            return this[l-length+1..l];
        }
        else {
            return [];
        }
    }
    
    "Trim the elements satisfying the given predicate
     function from the start and end of this sequence, 
     returning a sequence no longer than this sequence."
    shared actual default Element[] trim(
        Boolean trimming(Element&Object elem))
            => [*super.trim(trimming)]; //TODO: inefficient?
    
    "Trim the elements satisfying the given predicate
     function from the start of this sequence, returning 
     a sequence no longer than this sequence."
    shared actual default Element[] trimLeading(
        Boolean trimming(Element&Object elem))
            => [*super.trimLeading(trimming)]; //TODO: inefficient?
    
    "Trim the elements satisfying the given predicate
     function from the end of this sequence, returning a 
     sequence no longer than this sequence."
    shared actual default Element[] trimTrailing(
        Boolean trimming(Element&Object elem))
            => [*super.trimTrailing(trimming)]; //TODO: inefficient?
    
    //TODO: add when backend bug is fixed
    //shared actual default [Element[],Element[]] slice(Integer index)
    //        => [this[...index-1], this[index...]];
        
    "This sequence."
    shared actual default Element[] clone() => this;
    
    "A string of form `\"[ x, y, z ]\"` where `x`, `y`, and 
     `z` are the `string` representations of the elements of 
     this collection, as produced by the iterator of the 
     collection, or the string `\"{}\"` if this collection 
     is empty. If the collection iterator produces the value 
     `null`, the string representation contains the string <commit_msg>Sequential: enabled slice because ceylon/ceylon-compiler#1697 now works<commit_after>"A possibly-empty, immutable sequence of values. The type 
 `Sequential<Element>` may be abbreviated `[Element*]` or 
 `Element[]`. 
 
 `Sequential` has two enumerated subtypes:
 
 - `Empty`, abbreviated `[]`, represents an empty sequence, 
    and
 - `Sequence<Element>`, abbreviated `[Element+]` represents 
    a non-empty sequence, and has the very important 
    subclass [[Tuple]]."
see (`class Tuple`)
shared interface Sequential<out Element>
        of []|[Element+]
        satisfies List<Element> & 
                  Ranged<Integer,Element,Element[]> {
    
    "This sequence."
    shared actual default Element[] sequence() => this;
    
    "The rest of the sequence, without the first element."
    shared actual formal Element[] rest;
    
    "A sequence containing all indexes of this sequence."
    shared actual default Integer[] keys => 0:size;
    
    shared actual formal Element[] reversed;
    
    shared actual formal Element[] reverse();
    
    "Returns a sequence formed by repeating the elements of 
     this sequence the given number of times, or an empty 
     sequence if `times<=0`."
    shared actual default Element[] repeat(Integer times)
            => [*cycle(times)];
    
    "Select the first elements of this sequence, returning 
     a sequence no longer than the given length. If this 
     sequence is shorter than the given length, return this 
     sequence. Otherwise return a sequence of the given 
     length."
    shared actual default Element[] initial(Integer length)
            => this[0:length];
    
    "Select the last elements of the sequence, returning a 
     sequence no longer than the given length. If this 
     sequence is shorter than the given length, return this 
     sequence. Otherwise return a sequence of the given 
     length."
    shared actual default Element[] terminal(Integer length) {
        if (exists l = lastIndex, length>0) {
            return this[l-length+1..l];
        }
        else {
            return [];
        }
    }
    
    "Trim the elements satisfying the given predicate
     function from the start and end of this sequence, 
     returning a sequence no longer than this sequence."
    shared actual default Element[] trim(
        Boolean trimming(Element&Object elem))
            => [*super.trim(trimming)]; //TODO: inefficient?
    
    "Trim the elements satisfying the given predicate
     function from the start of this sequence, returning 
     a sequence no longer than this sequence."
    shared actual default Element[] trimLeading(
        Boolean trimming(Element&Object elem))
            => [*super.trimLeading(trimming)]; //TODO: inefficient?
    
    "Trim the elements satisfying the given predicate
     function from the end of this sequence, returning a 
     sequence no longer than this sequence."
    shared actual default Element[] trimTrailing(
        Boolean trimming(Element&Object elem))
            => [*super.trimTrailing(trimming)]; //TODO: inefficient?
    
    shared actual default [Element[],Element[]] slice(Integer index)
            => [this[...index-1], this[index...]];
        
    "This sequence."
    shared actual default Element[] clone() => this;
    
    "A string of form `\"[ x, y, z ]\"` where `x`, `y`, and 
     `z` are the `string` representations of the elements of 
     this collection, as produced by the iterator of the 
     collection, or the string `\"{}\"` if this collection 
     is empty. If the collection iterator produces the value 
     `null`, the string representation contains the string 
{'fraction_non_alphanumeric': 0.08930525164113785, 'fraction_numerical': 0.002188183807439825, 'mean_word_length': 2.7121827411167514, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, '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': '1066399', 'n_tokens_mistral': 1883, 'n_tokens_neox': 1757, 'n_words': 795}