<commit_before>/// Sassiin
///
/// @copyright   Copyright 2015, <NAME>
/// @license     http://tunne.la/MIT.txt The MIT License

@charset "UTF-8";

/// @group List
///
/// @parameter {arglist} $args...
///
/// @requires {function} map-set
/// @requires {function} multi-list-column
///
/// @throws multi-list-column() expects at least 2 parameters, #{$argc} given
/// @throws multi-list-column() expects parameter 1 to be a list of lists, #{$list-type} given
/// @throws multi-list-column() expects parameter 2 to be a number, larger or equal than 1, #{$column-key-type} given
/// @throws multi-list-column() expects parameter 3 to be a number, larger or equal than 1, #{$index-key-type} given
/// @throws multi-list-column() expects parameter 1 to be a list of lists, the list contains at least one #{$inner-list-type}
@function multi-list-column($args...) {
  $argc: length($args);

  @if $argc < 2 {
    @error "multi-list-column() expects at least 2 parameters, #{$argc} given";
  }
  $list: nth($args, 1);
  $list-type: type-of($list);

  @if $list-type != list {
    @error "multi-list-column() expects parameter 1 to be a list of lists, #{$list-type} given";
  }
  $column-key: nth($args, 2);
  $column-key-type: type-of($column-key);

  @if $column-key-type != number or $column-key < 1 {
    @error "multi-list-column() expects parameter 2 to be a number, larger or equal than 1, #{$column-key-type} given";
  }
  $index-key: null;
  $return-map: false;

  @if $argc == 3 {
    $index-key: nth($args, 3);
    $index-key-type: type-of($index-key);

    @if $index-key-type != number or $index-key < 1 {
      @error "multi-list-column() expects parameter 3 to be a number, larger or equal than 1, #{$index-key-type} given";
    }
    $return-map: true;
  }
  $list-length: length($list);
  $columns: ();

  @for $i from 1 through $list-length {
    $inner-list: nth($list, $i);
    $inner-list-type: type-of($inner-list);
    
    @if $inner-list-type != list {
      @error "multi-list-column() expects parameter 1 to be a list of lists, the list contains at least one #{$inner-list-type}";
    }
    $inner-list-length: length($inner-list);

    @if $column-key <= $inner-list-length and ($index-key == null or $index-key <= $inner-list-length) {
      $value: nth($inner-list, $column-key);

      @if $return-map {
        $index: nth($inner-list, $index-key);
        $columns: map-set($columns, $index, $value);
      } @else {
        $columns: append($columns, $value);
      }
    }
  }
  @return $columns;
}

/// @group List
///
/// @parameter $list
///
/// @requires {function} list-merge
/// @requires {function} list-slice
/// @requires {function} num-compare
/// @requires {function} quick-list-sort
/// @requires {function} str-compare
@function quick-list-sort($list) {
  @if length($list) < 2 {
    @return $list;
  }
  $left: ();
  $right: ();
  $pivot: nth($list, 1);
  $pivot-type: type-of($pivot);
  $pivot-length: str-length("" + $pivot);
  $list: list-slice($list, 2, length($list) - 1);

  @each $item in $list {
    $item-type: type-of($item);
    $item-length: str-length("" + $item);
    $compare: null;

    @if $item-type == string or $pivot-type == string {
      $compare: str-compare($item, $pivot);
    } @else {
      $compare: num-compare($item, $pivot);
    }
    @if $compare < 0 {
      $left: append($left, $item);
    } @else {
      $right: append($right, $item);
    }
  }
  $new-pivot: ();
  $new-pivot: append($new-pivot, $pivot);

    @return list-merge(quick-list-sort($left), $new-pivot, quick-list-sort($right));
}

/// @group List
///
/// @parameter {arglist} $args...
///
/// @requires {function} list-slice
///
/// @throws list-slice() expects at least 2 parameters, #{$argc} given
/// @throws list-slice() expects parameter 1 to be a list, #{$list-type} given
/// @throws list-slice() expects parameter 2 to be an integer, #{$offset-type} given
/// @throws list-slice() expects parameter 3 to be an integer, #{$end-type} given
@function list-slice($args...) {
  $argc: length($args);

  @if $argc < 2 {
    @error "list-slice() expects at least 2 parameters, #{$argc} given";
  }<commit_msg>New list-split-value-function<commit_after>/// Sassiin
///
/// @copyright   Copyright 2015, <NAME>
/// @license     http://tunne.la/MIT.txt The MIT License

@charset "UTF-8";

/// @group List
///
/// @parameter {arglist} $args...
///
/// @requires {function} map-set
/// @requires {function} multi-list-column
///
/// @throws multi-list-column() expects at least 2 parameters, #{$argc} given
/// @throws multi-list-column() expects parameter 1 to be a list of lists, #{$list-type} given
/// @throws multi-list-column() expects parameter 2 to be a number, larger or equal than 1, #{$column-key-type} given
/// @throws multi-list-column() expects parameter 3 to be a number, larger or equal than 1, #{$index-key-type} given
/// @throws multi-list-column() expects parameter 1 to be a list of lists, the list contains at least one #{$inner-list-type}
@function multi-list-column($args...) {
  $argc: length($args);

  @if $argc < 2 {
    @error "multi-list-column() expects at least 2 parameters, #{$argc} given";
  }
  $list: nth($args, 1);
  $list-type: type-of($list);

  @if $list-type != list {
    @error "multi-list-column() expects parameter 1 to be a list of lists, #{$list-type} given";
  }
  $column-key: nth($args, 2);
  $column-key-type: type-of($column-key);

  @if $column-key-type != number or $column-key < 1 {
    @error "multi-list-column() expects parameter 2 to be a number, larger or equal than 1, #{$column-key-type} given";
  }
  $index-key: null;
  $return-map: false;

  @if $argc == 3 {
    $index-key: nth($args, 3);
    $index-key-type: type-of($index-key);

    @if $index-key-type != number or $index-key < 1 {
      @error "multi-list-column() expects parameter 3 to be a number, larger or equal than 1, #{$index-key-type} given";
    }
    $return-map: true;
  }
  $list-length: length($list);
  $columns: ();

  @for $i from 1 through $list-length {
    $inner-list: nth($list, $i);
    $inner-list-type: type-of($inner-list);
    
    @if $inner-list-type != list {
      @error "multi-list-column() expects parameter 1 to be a list of lists, the list contains at least one #{$inner-list-type}";
    }
    $inner-list-length: length($inner-list);

    @if $column-key <= $inner-list-length and ($index-key == null or $index-key <= $inner-list-length) {
      $value: nth($inner-list, $column-key);

      @if $return-map {
        $index: nth($inner-list, $index-key);
        $columns: map-set($columns, $index, $value);
      } @else {
        $columns: append($columns, $value);
      }
    }
  }
  @return $columns;
}

/// @group List
///
/// @parameter $list
///
/// @requires {function} list-merge
/// @requires {function} list-slice
/// @requires {function} num-compare
/// @requires {function} quick-list-sort
/// @requires {function} str-compare
@function quick-list-sort($list) {
  @if length($list) < 2 {
    @return $list;
  }
  $left: ();
  $right: ();
  $pivot: nth($list, 1);
  $pivot-type: type-of($pivot);
  $pivot-length: str-length("" + $pivot);
  $list: list-slice($list, 2, length($list) - 1);

  @each $item in $list {
    $item-type: type-of($item);
    $item-length: str-length("" + $item);
    $compare: null;

    @if $item-type == string or $pivot-type == string {
      $compare: str-compare($item, $pivot);
    } @else {
      $compare: num-compare($item, $pivot);
    }
    @if $compare < 0 {
      $left: append($left, $item);
    } @else {
      $right: append($right, $item);
    }
  }
  $new-pivot: ();
  $new-pivot: append($new-pivot, $pivot);

    @return list-merge(quick-list-sort($left), $new-pivot, quick-list-sort($right));
}

/// @group List
///
/// @parameter {list} $list
/// @parameter {string} $value
///
@function list-split-value($list, $value) {
  $list: list($list);
  $return: ();
  $index: 1;
  $prevIndex: 0;

  @each $item in $list {
    @if $item == $value {
      $index: $index + 1;
    } @else {
      @if $prevIndex < $index {
        $prevIndex: $prevIndex + 1;
        $return: append($return, ());
      }
      $nth-list: nth($return, $index);
      $nth-list: append($nth-list, $item);
      $return: set-nth($return, $index, $nth-list);
    }
  }
  @return $return;
}

/// @group List
///
/// @parameter {arglist} $args...
///
/// @requires {function} list-slice
///
/// @throws list-slice() expects at least 2 parameters, #{$argc} given
/// @throws list-slice() expects parameter 1 to be a list, #{$list-type} given
/// @throws list-slice() expects parameter 2 to be an integer, #{$offset-type} given
/// @throws list-slice() expects parameter 3 to be an integer, #{$end-type} given
@function list-slice($args...) {
  $argc: length($args);

  @if $argc < 2 {
    @error "list-slice() expects at least 2 parameters, #{$argc} given";
  }
{'fraction_non_alphanumeric': 0.19743358847366052, 'fraction_numerical': 0.009004952723998198, 'mean_word_length': 2.9262041537781704, 'pattern_counts': {'":': 0, '<': 22, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '188323', 'n_tokens_mistral': 3171, 'n_tokens_neox': 3066, 'n_words': 868}