<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Ledger.Infrastructure
{
	public static class Extensions
	{
		public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T> action)
		{
			foreach (var item in self)
			{
				action(item);
				yield return item;
			}
		}

		public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T, int> action)
		{
			var i = 0;
			foreach (var item in self)
			{
				action(item, i++);
				yield return item;
			}
		}

		public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
		{
			foreach (var item in self)
			{
				action(item);
			}
		}

		public static void ForEach<T>(this IEnumerable<T> self, Action<T, int> action)
		{
			var i = 0;
			foreach (var item in self)
			{
				action(item, i++);
			}
		}

		public static bool None<T>(this IEnumerable<T> self)
		{
			return self.Any() == false;
		}

		public static bool ImplementsSnapshottable(this Type aggregate)
		{
			return aggregate
				.GetInterfaces()
				.Where(i => i.IsGenericType)
				.Any(i => i.GetGenericTypeDefinition() == typeof(ISnapshotable<,>));
		}
	}
}<commit_msg>extensions: add extensions for creating sequences from integers<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Ledger.Infrastructure
{
	public static class Extensions
	{
		public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T> action)
		{
			foreach (var item in self)
			{
				action(item);
				yield return item;
			}
		}

		public static IEnumerable<T> Apply<T>(this IEnumerable<T> self, Action<T, int> action)
		{
			var i = 0;
			foreach (var item in self)
			{
				action(item, i++);
				yield return item;
			}
		}

		public static void ForEach<T>(this IEnumerable<T> self, Action<T> action)
		{
			foreach (var item in self)
			{
				action(item);
			}
		}

		public static void ForEach<T>(this IEnumerable<T> self, Action<T, int> action)
		{
			var i = 0;
			foreach (var item in self)
			{
				action(item, i++);
			}
		}

		public static bool None<T>(this IEnumerable<T> self)
		{
			return self.Any() == false;
		}

		public static bool ImplementsSnapshottable(this Type aggregate)
		{
			return aggregate
				.GetInterfaces()
				.Where(i => i.IsGenericType)
				.Any(i => i.GetGenericTypeDefinition() == typeof(ISnapshotable<,>));
		}

		public static Sequence AsSequence(this int self)
		{
			return new Sequence(self);
		}

		public static StreamSequence AsStreamSequence(this int self)
		{
			return new StreamSequence(self);
		}
	}
}
{'fraction_non_alphanumeric': 0.12044926413632842, 'fraction_numerical': 0.001549186676994578, 'mean_word_length': 3.305, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 41, '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': '1990232', 'n_tokens_mistral': 1055, 'n_tokens_neox': 868, 'n_words': 239}