Skip to content

Comments

Map, Filter, Fold#7

Open
Andrw-404 wants to merge 3 commits intomainfrom
MapFilterFold
Open

Map, Filter, Fold#7
Andrw-404 wants to merge 3 commits intomainfrom
MapFilterFold

Conversation

@Andrw-404
Copy link
Owner

No description provided.

/// <param name="start">Incoming accumulated value.</param>
/// <param name="function">The accumulation function.</param>
/// <returns>The final accumulated value.</returns>
public static TAcc Fold<T, TAcc>(List<T> inputList, TAcc start, Func<TAcc, T, TAcc> function)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TAcc можно и расшифровать :)

/// <returns>The final accumulated value.</returns>
public static TAcc Fold<T, TAcc>(List<T> inputList, TAcc start, Func<TAcc, T, TAcc> function)
{
var acc = start;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accumulator и initialValue?

/// <summary>
/// A class for implementing the Filter function.
/// </summary>
public class HaveFilter

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Классы тоже стоит static модификаторами отметить

@@ -0,0 +1,39 @@
namespace FunctionalUtils.Tests
{
public class Tests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если функции с генерик-типами, то надо здесь проверить, что на списках строк ничего не сломается, например.
И на пустом списке все функции ещё бы попробовать

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants