-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#131 - Support aliases for simplify, deriv and etc.
- Loading branch information
Showing
22 changed files
with
255 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) Dmytro Kyshchenko. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Immutable; | ||
|
||
namespace xFunc.Maths.Expressions; | ||
|
||
/// <summary> | ||
/// Extension methods for <see cref="Lambda"/> and <see cref="LambdaExpression"/>. | ||
/// </summary> | ||
public static class LambdaExtensions | ||
{ | ||
/// <summary> | ||
/// Converts <paramref name="exp"/> to <see cref="Lambda"/> without parameters. | ||
/// </summary> | ||
/// <param name="exp">The expression to convert.</param> | ||
/// <returns>The lambda.</returns> | ||
public static Lambda ToLambda(this IExpression exp) | ||
=> new Lambda(exp); | ||
|
||
/// <summary> | ||
/// Converts <paramref name="exp"/> to <see cref="Lambda"/> without parameters. | ||
/// </summary> | ||
/// <param name="exp">The expression to convert.</param> | ||
/// <param name="variables">The list of lambda parameters.</param> | ||
/// <returns>The lambda.</returns> | ||
public static Lambda ToLambda(this IExpression exp, params string[] variables) | ||
=> new Lambda(variables, exp); | ||
|
||
/// <summary> | ||
/// Converts <paramref name="exp"/> to <see cref="Lambda"/> without parameters. | ||
/// </summary> | ||
/// <param name="exp">The expression to convert.</param> | ||
/// <param name="variables">The list of lambda parameters.</param> | ||
/// <returns>The lambda.</returns> | ||
public static Lambda ToLambda(this IExpression exp, ImmutableArray<string> variables) | ||
=> new Lambda(variables, exp); | ||
|
||
/// <summary> | ||
/// Converts <paramref name="exp"/> to <see cref="LambdaExpression"/> without parameters. | ||
/// </summary> | ||
/// <param name="exp">The expression to convert.</param> | ||
/// <returns>The lambda expression.</returns> | ||
public static LambdaExpression ToLambdaExpression(this IExpression exp) | ||
=> ToLambda(exp).AsExpression(); | ||
|
||
/// <summary> | ||
/// Converts <paramref name="exp"/> to <see cref="LambdaExpression"/> without parameters. | ||
/// </summary> | ||
/// <param name="exp">The expression to convert.</param> | ||
/// <param name="variables">The list of lambda parameters.</param> | ||
/// <returns>The lambda expression.</returns> | ||
public static LambdaExpression ToLambdaExpression(this IExpression exp, params string[] variables) | ||
=> ToLambda(exp, variables).AsExpression(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.