<commit_before>﻿using DragonSpark.Model.Selection;
using DragonSpark.Model.Sequences;
using DragonSpark.Model.Sequences.Collections;
using DragonSpark.Runtime;
using NetFabric.Hyperlinq;
using System;
using System.Collections.Generic;
using System.Linq;

// ReSharper disable TooManyArguments
// ReSharper disable once PossibleInvalidOperationException
// ReSharper disable once MismatchedFileName

namespace DragonSpark.Compose
{
	public static partial class ExtensionMethods
	{
		public static T[] Open<T>(this IEnumerable<T> @this) => @this is T[] array ? array : @this.ToArray();

		public static Array<T> Result<T>(this IEnumerable<T> @this) => @this.Open();

		public static IArray<T> Promote<T>(this Array<T> @this) => new ArrayInstance<T>(@this);

		public static EnumerableExtensions.ValueEnumerableWrapper<T1> Get<T1, T2>(this IEnumerable<ISelect<T2, T1>> @this,
		                                                                T2 parameter)
			=> @this.Introduce(parameter, tuple => tuple.Item1.Get(tuple.Item2)).AsValueEnumerable();

		public static IEnumerable<T1> Introduce<T1, T2>(this IEnumerable<Func<T2, T1>> @this, T2 instance)
			=> @this.Introduce(instance, tuple => tuple.Item1(tuple.Item2));

		public static IEnumerable<(T1, T2)> Introduce<T1, T2>(this IEnumerable<T1> @this, T2 instance)
			=> @this.Introduce(instance, _ => true, Delegates<(T1, T2)>.Self);

		public static IEnumerable<T1> Introduce<T1, T2>(this IEnumerable<T1> @this, T2 instance,
		                                                Func<(T1, T2), bool> where)
			=> @this.Introduce(instance, where, tuple => tuple.Item1);

		public static IEnumerable<TOut> Introduce<T1, T2, TOut>(this IEnumerable<T1> @this, T2 instance,
		                                                        Func<(T1, T2), TOut> select)
			=> @this.Introduce(instance, _ => true, select);

		public static IEnumerable<TOut> Introduce<T1, T2, TOut>(this IEnumerable<T1> @this, T2 instance,
		                                                        Func<(T1, T2), bool> where,
		                                                        Func<(T1, T2), TOut> select)
		{
			foreach (var item in @this)
			{
				var tuple = (item, instance);
				if (where(tuple))
				{
					yield return select(tuple);
				}
			}
		}

		public static bool AnyTrue(this IEnumerable<bool> source)
		{
			foreach (var b in source)
			{
				if (b)
				{
					return true;
				}
			}

			return false;
		}
<commit_msg>Wrapped Enumerable<commit_after>﻿using DragonSpark.Model.Selection;
using DragonSpark.Model.Sequences;
using DragonSpark.Model.Sequences.Collections;
using DragonSpark.Runtime;
using NetFabric.Hyperlinq;
using System;
using System.Collections.Generic;
using System.Linq;

// ReSharper disable TooManyArguments
// ReSharper disable once PossibleInvalidOperationException
// ReSharper disable once MismatchedFileName

namespace DragonSpark.Compose
{
	public static partial class ExtensionMethods
	{
		public static T[] Open<T>(this IEnumerable<T> @this) => @this is T[] array ? array : @this.ToArray();

		public static Array<T> Result<T>(this IEnumerable<T> @this) => @this.Open();

		public static IArray<T> Promote<T>(this Array<T> @this) => new ArrayInstance<T>(@this);

		public static EnumerableExtensions.ValueEnumerableWrapper<T1> Get<T1, T2>(this IEnumerable<ISelect<T2, T1>> @this,
		                                                                T2 parameter)
			=> @this.Introduce(parameter, tuple => tuple.Item1.Get(tuple.Item2)).AsValueEnumerable();

		public static IEnumerable<T1> Introduce<T1, T2>(this IEnumerable<Func<T2, T1>> @this, T2 instance)
			=> @this.Introduce(instance, tuple => tuple.Item1(tuple.Item2));

		public static IEnumerable<(T1, T2)> Introduce<T1, T2>(this IEnumerable<T1> @this, T2 instance)
			=> @this.Introduce(instance, _ => true, Delegates<(T1, T2)>.Self);

		public static IEnumerable<T1> Introduce<T1, T2>(this IEnumerable<T1> @this, T2 instance,
		                                                Func<(T1, T2), bool> where)
			=> @this.Introduce(instance, where, tuple => tuple.Item1);

		public static IEnumerable<TOut> Introduce<T1, T2, TOut>(this IEnumerable<T1> @this, T2 instance,
		                                                        Func<(T1, T2), TOut> select)
			=> @this.Introduce(instance, _ => true, select);

		public static IEnumerable<TOut> Introduce<T1, T2, TOut>(this IEnumerable<T1> @this, T2 instance,
		                                                        Func<(T1, T2), bool> where,
		                                                        Func<(T1, T2), TOut> select)
		{
			foreach (var item in @this.AsValueEnumerable())
			{
				var tuple = (item, instance);
				if (where(tuple!))
				{
					yield return select(tuple!);
				}
			}
		}

		public static bool AnyTrue(this IEnumerable<bool> source)
		{
			foreach (var b in source)
			{
				if (b)
				{
					return true;
				}
			}

			return false;
		}

{'fraction_non_alphanumeric': 0.12325440194292653, 'fraction_numerical': 0.01861971260878365, 'mean_word_length': 2.7354497354497354, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7638187', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1515, 'n_words': 369}