<commit_before>// The Art of C++ / Sequences
// Copyright (c) 2015 <NAME>

#include <tao/seq/plus.hpp>
#include <tao/seq/minus.hpp>
#include <tao/seq/sum.hpp>
#include <tao/seq/map.hpp>
#include <tao/seq/exclusive_scan.hpp>
#include <tao/seq/inclusive_scan.hpp>

#include <type_traits>

using namespace tao::seq;

template< std::size_t M, typename >
struct count_less_or_equal;

template< std::size_t M, std::size_t... Ns >
struct count_less_or_equal< M, index_sequence< Ns... > >
  : sum< std::size_t, ( ( Ns <= M ) ? 1 : 0 )... >
{};

template< typename, typename >
struct expand;

template< std::size_t... Is, typename S >
struct expand< index_sequence< Is... >, S >
{
  using type = index_sequence< count_less_or_equal< Is, S >::value...  >;
};

template< typename I, typename S >
using expand_t = typename expand< I, S >::type;

int main()
{
  using S = index_sequence< 2, 1, 3, 0, 1, 1, 3 >;
  using I = make_index_sequence< sum< S >::value >;

  using OUTER = expand_t< I, inclusive_scan_t< S > >;
  using INNER = minus_t< I, map_t< OUTER, exclusive_scan_t< S > > >;

  static_assert( std::is_same< OUTER, index_sequence< 0, 0, 1, 2, 2, 2, 4, 5, 6, 6, 6 > >::value, "oops" );
  static_assert( std::is_same< INNER, index_sequence< 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 2 > >::value, "oops" );
}
<commit_msg>Ordered/fixed headers<commit_after>// The Art of C++ / Sequences
// Copyright (c) 2015 <NAME>

#include <tao/seq/integer_sequence.hpp>
#include <tao/seq/sum.hpp>
#include <tao/seq/make_integer_sequence.hpp>
#include <tao/seq/inclusive_scan.hpp>
#include <tao/seq/minus.hpp>
#include <tao/seq/map.hpp>
#include <tao/seq/exclusive_scan.hpp>

#include <type_traits>

using namespace tao::seq;

template< std::size_t M, typename >
struct count_less_or_equal;

template< std::size_t M, std::size_t... Ns >
struct count_less_or_equal< M, index_sequence< Ns... > >
  : sum< std::size_t, ( ( Ns <= M ) ? 1 : 0 )... >
{};

template< typename, typename >
struct expand;

template< std::size_t... Is, typename S >
struct expand< index_sequence< Is... >, S >
{
  using type = index_sequence< count_less_or_equal< Is, S >::value...  >;
};

template< typename I, typename S >
using expand_t = typename expand< I, S >::type;

int main()
{
  using S = index_sequence< 2, 1, 3, 0, 1, 1, 3 >;
  using I = make_index_sequence< sum< S >::value >;

  using OUTER = expand_t< I, inclusive_scan_t< S > >;
  using INNER = minus_t< I, map_t< OUTER, exclusive_scan_t< S > > >;

  static_assert( std::is_same< OUTER, index_sequence< 0, 0, 1, 2, 2, 2, 4, 5, 6, 6, 6 > >::value, "oops" );
  static_assert( std::is_same< INNER, index_sequence< 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 2 > >::value, "oops" );
}

{'fraction_non_alphanumeric': 0.17757009345794392, 'fraction_numerical': 0.026168224299065422, 'mean_word_length': 4.049056603773585, 'pattern_counts': {'":': 0, '<': 72, '<?xml version=': 0, '>': 70, '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': '7456932', 'n_tokens_mistral': 1166, 'n_tokens_neox': 1059, 'n_words': 301}