-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Statics-SyntaxHacks.cs
607 lines (514 loc) · 27.1 KB
/
Statics-SyntaxHacks.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
namespace Towel;
/// <summary>Root type of the static functional methods in Towel.</summary>
public static partial class Statics
{
#region Keywords
/// <summary>Stepper was not broken.</summary>
public const StepStatus Continue = StepStatus.Continue;
/// <summary>Stepper was broken.</summary>
public const StepStatus Break = StepStatus.Break;
/// <summary>The Goal was found.</summary>
public const GraphSearchStatus Goal = GraphSearchStatus.Goal;
/// <summary>The left operand is less than the right operand.</summary>
public const CompareResult Less = CompareResult.Less;
/// <summary>The left operand is equal to the right operand.</summary>
public const CompareResult Equal = CompareResult.Equal;
/// <summary>The left operand is greater than the right operand.</summary>
public const CompareResult Greater = CompareResult.Greater;
/// <summary>There is no bound.</summary>
public const Omnitree.Keyword None = Omnitree.Keyword.None;
/// <summary>The default case in a Switch statement (true).</summary>
public const SwitchSyntax.Keyword Default = SwitchSyntax.Keyword.Default;
#endregion
#region Switch
/// <summary>Syntax sugar Switch statements.</summary>
/// <param name="possibleActions">The possible actions of the Switch statement.</param>
public static void Switch(params (SwitchSyntax.Condition, Action)[] possibleActions) =>
SwitchSyntax.Do(possibleActions);
/// <summary>Syntax sugar Switch statements.</summary>
/// <typeparam name="T">The generic type parameter to the Switch statement.</typeparam>
/// <param name="value">The value argument of the Switch statement.</param>
/// <returns>The delegate for the Switch statement.</returns>
public static SwitchSyntax.ParamsAction<SwitchSyntax.Condition<T>, Action> Switch<T>(T value) =>
SwitchSyntax.Do<T>(value);
/// <summary>Definitions for Switch syntax.</summary>
public static class SwitchSyntax
{
/// <summary>Delegate with params intended to be used with the Switch syntax.</summary>
/// <typeparam name="TA">The first type in the value tuples in the array.</typeparam>
/// <typeparam name="TB">The second type in the value tuples in the array.</typeparam>
/// <param name="values">The param values.</param>
public delegate void ParamsAction<TA, TB>(params (TA, TB)[] values);
internal static ParamsAction<Condition<T>, Action> Do<T>(T value) =>
possibleActions =>
{
foreach (var possibleAction in possibleActions)
{
if (possibleAction.Item1.Resolve(value))
{
possibleAction.Item2();
return;
}
}
};
internal static void Do(params (Condition Condition, Action Action)[] possibleActions)
{
foreach (var possibleAction in possibleActions)
{
if (possibleAction.Condition)
{
possibleAction.Action();
return;
}
}
}
/// <summary>Intended to be used with Switch syntax.</summary>
public enum Keyword
{
/// <summary>The default keyword for the the Switch syntax.</summary>
Default,
}
/// <summary>Represents the result of a conditional expression inside Switch syntax.</summary>
/// <typeparam name="T">The generic type of the Switch condition for equality checks.</typeparam>
public abstract class Condition<T>
{
/// <summary>Resolves the condition to a bool.</summary>
/// <param name="b">The right value to compare this condition to.</param>
/// <returns>The result of the condition.</returns>
public abstract bool Resolve(T b);
/// <summary>Casts a <typeparamref name="T"/> to a bool using an equality check.</summary>
/// <param name="value">The value this condition will compare with.</param>
public static implicit operator Condition<T>(T value) => new Value<T>(a: value);
/// <summary>Uses the bool as the condition result.</summary>
/// <param name="result">The <see cref="bool"/>result of this condition.</param>
public static implicit operator Condition<T>(bool result) => new Bool<T> { Result = result, };
#pragma warning disable IDE0079 // Remove unnecessary suppression
#pragma warning disable IDE0060 // Remove unused parameter
/// <summary>Converts a keyword to a condition result (for "Default" case).</summary>
/// <param name="keyword"><see cref="Keyword.Default"/></param>
public static implicit operator Condition<T>(Keyword keyword) => new Default<T>();
#pragma warning restore IDE0060 // Remove unused parameter
#pragma warning restore IDE0079 // Remove unnecessary suppression
}
internal class Value<T> : Condition<T>
{
/// <summary>The value of this condition for an equality check.</summary>
internal T A;
public override bool Resolve(T b) => Equate(A, b);
public Value(T a)
{
A = a;
}
}
internal class Bool<T> : Condition<T>
{
internal bool Result;
public override bool Resolve(T b) => Result;
}
internal class Default<T> : Condition<T>
{
public override bool Resolve(T b) => true;
}
/// <summary>Represents the result of a conditional expression inside Switch syntax.</summary>
public abstract class Condition
{
/// <summary>Resolves the condition to a bool.</summary>
/// <returns>The result of the condition.</returns>
public abstract bool Resolve();
/// <summary>Uses the bool as the condition result.</summary>
/// <param name="result">The <see cref="bool"/>result of this condition.</param>
public static implicit operator Condition(bool result) => new Bool { Result = result, };
#pragma warning disable IDE0079 // Remove unnecessary suppression
#pragma warning disable IDE0060 // Remove unused parameter
/// <summary>Converts a keyword to a condition result (for "Default" case).</summary>
/// <param name="keyword"><see cref="Keyword.Default"/></param>
public static implicit operator Condition(Keyword keyword) => new Default();
#pragma warning restore IDE0060 // Remove unused parameter
#pragma warning restore IDE0079 // Remove unnecessary suppression
/// <summary>Converts a condition to a bool using the Resolve method.</summary>
/// <param name="condition">The condition to resolve to a <see cref="bool"/> value.</param>
public static implicit operator bool(Condition condition) => condition.Resolve();
}
internal class Bool : Condition
{
internal bool Result;
public override bool Resolve() => Result;
}
internal class Default : Condition
{
public override bool Resolve() => true;
}
}
#endregion
#region Chance
#pragma warning disable CA2211 // Non-constant fields should not be visible
#pragma warning disable IDE0079 // Remove unnecessary suppression
#pragma warning disable IDE0075 // Simplify conditional expression
#pragma warning disable IDE0060 // Remove unused parameter
/// <summary>Allows chance syntax with "using static Towel.Syntax;".</summary>
/// <example>25% Chance</example>
public static ChanceSyntax Chance => default;
/// <summary>Struct that allows percentage syntax that will be evaluated at runtime.</summary>
public struct ChanceSyntax
{
/// <summary>Creates a chance from a percentage that will be evaluated at runtime.</summary>
/// <param name="percentage">The value of the percentage.</param>
/// <param name="chance">The chance syntax struct object.</param>
/// <returns>True if the the chance hits. False if not.</returns>
public static bool operator %(double percentage, ChanceSyntax chance) =>
percentage < 0d ? throw new ArgumentOutOfRangeException(nameof(chance)) :
percentage > 100d ? throw new ArgumentOutOfRangeException(nameof(chance)) :
percentage is 100d ? true :
percentage is 0d ? false :
Random.Shared.NextDouble() < percentage / 100d;
}
#pragma warning restore IDE0060 // Remove unused parameter
#pragma warning restore IDE0075 // Simplify conditional expression
#pragma warning restore IDE0079 // Remove unnecessary suppression
#pragma warning restore CA2211 // Non-constant fields should not be visible
#endregion
#region Inequality
/// <summary>Used for inequality syntax.</summary>
/// <typeparam name="T">The generic type of elements the inequality is being used on.</typeparam>
public struct Inequality<T>
{
internal bool Cast;
internal T A;
/// <summary>Contructs a new <see cref="Inequality{T}"/>.</summary>
/// <param name="a">The initial value of the running inequality.</param>
public static implicit operator Inequality<T>(T a) =>
new()
{
Cast = true,
A = a,
};
/// <summary>Adds a greater than operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the greater than operation.</param>
/// <returns>A running inequality with the additonal greater than operation.</returns>
public static OperatorValidated.Inequality<T> operator >(Inequality<T> a, T b) =>
!a.Cast ? throw new InequalitySyntaxException() :
new OperatorValidated.Inequality<T>(Compare(a.A, b) == Greater, b);
/// <summary>Adds a less than operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the less than operation.</param>
/// <returns>A running inequality with the additonal less than operation.</returns>
public static OperatorValidated.Inequality<T> operator <(Inequality<T> a, T b) =>
!a.Cast ? throw new InequalitySyntaxException() :
new OperatorValidated.Inequality<T>(Compare(a.A, b) == Less, b);
/// <summary>Adds a greater than or equal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the greater than or equal operation.</param>
/// <returns>A running inequality with the additonal greater than or equal operation.</returns>
public static OperatorValidated.Inequality<T> operator >=(Inequality<T> a, T b) =>
!a.Cast ? throw new InequalitySyntaxException() :
new OperatorValidated.Inequality<T>(Compare(a.A, b) != Less, b);
/// <summary>Adds a less than or equal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the less than or equal operation.</param>
/// <returns>A running inequality with the additonal less than or equal operation.</returns>
public static OperatorValidated.Inequality<T> operator <=(Inequality<T> a, T b) =>
!a.Cast ? throw new InequalitySyntaxException() :
new OperatorValidated.Inequality<T>(Compare(a.A, b) != Greater, b);
/// <summary>Adds an equal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the equal operation.</param>
/// <returns>A running inequality with the additonal equal operation.</returns>
public static OperatorValidated.Inequality<T> operator ==(Inequality<T> a, T b) =>
!a.Cast ? throw new InequalitySyntaxException() :
new OperatorValidated.Inequality<T>(Equate(a.A, b), b);
/// <summary>Adds an inequal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the inequal operation.</param>
/// <returns>A running inequality with the additonal inequal operation.</returns>
public static OperatorValidated.Inequality<T> operator !=(Inequality<T> a, T b) =>
!a.Cast ? throw new InequalitySyntaxException() :
new OperatorValidated.Inequality<T>(Inequate(a.A, b), b);
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
/// <summary>This member is not intended to be invoked.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, true)]
public override string ToString() => throw new InequalitySyntaxException();
/// <summary>This member is not intended to be invoked.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, true)]
public override bool Equals(object? obj) => throw new InequalitySyntaxException();
/// <summary>This member is not intended to be invoked.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, true)]
public override int GetHashCode() => throw new InequalitySyntaxException();
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
}
/// <summary>Helper type for inequality syntax. Contains an Inequality type that has been operator validated.</summary>
public static partial class OperatorValidated
{
/// <summary>Used for inequality syntax.</summary>
/// <typeparam name="T">The generic type of elements the inequality is being used on.</typeparam>
public struct Inequality<T>
{
internal readonly bool Result;
internal readonly T A;
internal Inequality(bool result, T a)
{
Result = result;
A = a;
}
/// <summary>Converts this running inequality into the result of the expression.</summary>
/// <param name="inequality">The inequality to convert into the result of the expression.</param>
public static implicit operator bool(Inequality<T> inequality) => inequality.Result;
/// <summary>Adds a greater than operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the greater than operation.</param>
/// <returns>A running inequality with the additonal greater than operation.</returns>
public static Inequality<T> operator >(Inequality<T> a, T b) => new(a.Result && Compare(a.A, b) == Greater, b);
/// <summary>Adds a less than operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the less than operation.</param>
/// <returns>A running inequality with the additonal less than operation.</returns>
public static Inequality<T> operator <(Inequality<T> a, T b) => new(a.Result && Compare(a.A, b) == Less, b);
/// <summary>Adds a greater than or equal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the greater than or equal operation.</param>
/// <returns>A running inequality with the additonal greater than or equal operation.</returns>
public static Inequality<T> operator >=(Inequality<T> a, T b) => new(a.Result && Compare(a.A, b) != Less, b);
/// <summary>Adds a less than or equal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the less than or equal operation.</param>
/// <returns>A running inequality with the additonal less than or equal operation.</returns>
public static Inequality<T> operator <=(Inequality<T> a, T b) => new(a.Result && Compare(a.A, b) != Greater, b);
/// <summary>Adds an equal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the equal operation.</param>
/// <returns>A running inequality with the additonal equal operation.</returns>
public static Inequality<T> operator ==(Inequality<T> a, T b) => new(a.Result && Equate(a.A, b), b);
/// <summary>Adds an inequal operation to a running inequality.</summary>
/// <param name="a">The current running inequality and left hand operand.</param>
/// <param name="b">The value of the right hand operand of the inequal operation.</param>
/// <returns>A running inequality with the additonal inequal operation.</returns>
public static Inequality<T> operator !=(Inequality<T> a, T b) => new(a.Result && Inequate(a.A, b), b);
/// <summary>Converts the result of this inequality to a <see cref="string"/>.</summary>
/// <inheritdoc/>
public override string ToString() => Result.ToString();
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
/// <summary>This member is not intended to be invoked.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, true)]
public override bool Equals(object? obj) => throw new InequalitySyntaxException();
/// <summary>This member is not intended to be invoked.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, true)]
public override int GetHashCode() => throw new InequalitySyntaxException();
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
}
}
#endregion
#region UniversalQuantification
#pragma warning disable CS0618 // Type or member is obsolete
/// <summary>Universal Quantification Operator.</summary>
/// <typeparam name="T">The element type of the universal quantification to declare.</typeparam>
/// <param name="values">The values of the universal quantification.</param>
/// <returns>The declared universal quantification.</returns>
public static UniversalQuantification<T> Ɐ<T>(params T[] values) => new(values);
#pragma warning restore CS0618 // Type or member is obsolete
/// <summary>Universal Quantification.</summary>
/// <typeparam name="T">The element type of the universal quantification.</typeparam>
public struct UniversalQuantification<T> :
System.Collections.Generic.IEnumerable<T>,
System.Collections.Generic.IList<T>,
IArray<T>
{
internal T[] Value;
/// <summary>Not intended to be invoked directly.</summary>
/// <param name="array">The array value of the universal quantification.</param>
[Obsolete(NotIntended, false)]
internal UniversalQuantification(T[] array) => Value = array;
#region Towel.Datastructures.IArray<T>
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public int Length => Value.Length;
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public StepStatus StepperBreak<TStep>(TStep step = default)
where TStep : struct, IFunc<T, StepStatus> =>
Value.StepperBreak(step);
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public T[] ToArray() => Value;
#endregion
#region System.Collections.Generic.IList<T>
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public T this[int index]
{
get => Value[index];
set => Value[index] = value;
}
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public int Count => Value.Length;
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public bool IsReadOnly => false;
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public void Add(T item)
{
T[] newValue = new T[Value.Length + 1];
Array.Copy(Value, newValue, Value.Length);
newValue[Value.Length] = item;
Value = newValue;
}
/// <summary>Not intended to be invoked directly.</summary>
[Obsolete(NotIntended, false)]
public void Clear() => Value = Array.Empty<T>();
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public bool Contains(T item) => Value.Contains(item);
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public void CopyTo(T[] array, int arrayIndex) =>
Array.Copy(Value, 0, array, arrayIndex, Value.Length);
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public int IndexOf(T item) => Array.IndexOf(Value, item);
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public void Insert(int index, T item)
{
T[] newValue = new T[Value.Length + 1];
for (int i = 0; i < newValue.Length; i++)
{
newValue[i] = i == index
? item
: i < index
? Value[i]
: Value[i - 1];
}
Value = newValue;
}
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public bool Remove(T item)
{
T[] newValue = new T[Value.Length - 1];
bool found = false;
for (int i = 0; i < Value.Length; i++)
{
if (Equate(Value[i], item))
{
found = true;
}
else if (found)
{
newValue[i] = Value[i - 1];
}
else
{
newValue[i] = Value[i];
}
}
if (!found)
{
return false;
}
Value = newValue;
return true;
}
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public void RemoveAt(int index)
{
T[] newValue = new T[Value.Length - 1];
for (int i = 0; i < Value.Length; i++)
{
if (i != index)
{
if (i < index)
{
newValue[i] = Value[i];
}
else
{
newValue[i] = Value[i - 1];
}
}
}
Value = newValue;
}
#endregion
#region System.Collections.Generic.IEnumerable<T>
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
public System.Collections.Generic.IEnumerator<T> GetEnumerator() => ((System.Collections.Generic.IEnumerable<T>)Value).GetEnumerator();
/// <summary>Not intended to be invoked directly.</summary>
/// <inheritdoc/>
[Obsolete(NotIntended, false)]
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => Value.GetEnumerator();
#endregion
#region Implicit Casting Operators
/// <summary>Converts a universal quantification to a memory.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator ReadOnlyMemory<T>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value;
/// <summary>Converts a universal quantification to a memory.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Memory<T>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value;
/// <summary>Converts a universal quantification to a span.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator ReadOnlySpan<T>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value;
/// <summary>Converts a universal quantification to a span.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Span<T>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value;
/// <summary>Converts a universal quantification to an array.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator T[](UniversalQuantification<T> universalQuantification) => universalQuantification.Value;
/// <summary>Converts a universal quantification to a <see cref="System.Collections.Generic.List{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator System.Collections.Generic.List<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value);
/// <summary>Converts a universal quantification to an <see cref="System.Collections.Generic.HashSet{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator System.Collections.Generic.HashSet<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value);
/// <summary>Converts a universal quantification to a <see cref="System.Collections.Generic.LinkedList{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator System.Collections.Generic.LinkedList<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value);
/// <summary>Converts a universal quantification to an <see cref="System.Collections.Generic.Stack{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator System.Collections.Generic.Stack<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value);
/// <summary>Converts a universal quantification to an <see cref="System.Collections.Generic.Queue{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator System.Collections.Generic.Queue<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value);
/// <summary>Converts a universal quantification to a sorted <see cref="System.Collections.Generic.SortedSet{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator System.Collections.Generic.SortedSet<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value);
/// <summary>Converts a universal quantification to an Action<Action<T>>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Action<Action<T>>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value.ToStepper();
/// <summary>Converts a universal quantification to an Func<Func<T, StepStatus>, StepStatus>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Func<Func<T, StepStatus>, StepStatus>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value.ToStepperBreak();
/// <summary>Converts a universal quantification to an <see cref="Array{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Towel.DataStructures.Array<T>(UniversalQuantification<T> universalQuantification) => universalQuantification.Value;
/// <summary>Converts a universal quantification to an <see cref="ListArray{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Towel.DataStructures.ListArray<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value, universalQuantification.Value.Length);
/// <summary>Converts a universal quantification to an <see cref="StackArray{T}"/>.</summary>
/// <param name="universalQuantification">The universal quantification to be converted.</param>
public static implicit operator Towel.DataStructures.StackArray<T>(UniversalQuantification<T> universalQuantification) => new(universalQuantification.Value, universalQuantification.Value.Length, default);
#endregion
}
#endregion
}