Add XMLDoc documentation to functions
Some checks failed
Build / build (push) Successful in 33s
Tests / tests (push) Failing after 34s

This commit is contained in:
codex 2026-06-28 00:06:30 -05:00
commit a936188e46
10 changed files with 316 additions and 1 deletions

View file

@ -4,8 +4,19 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>lerp</c> function.
/// </summary>
/// <remarks>
/// The <c>lerp</c> function evaluates two numeric endpoints and an interpolation amount, then returns the value
/// at that position between the endpoints.
/// </remarks>
public class Lerp: FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>lerp</c>.</value>
public string Name
{
get
@ -14,6 +25,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>lerp</c> function.
/// </summary>
/// <value>Three numeric arguments named <c>start</c>, <c>end</c>, and <c>ammount</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -24,6 +39,15 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>lerp</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly three numeric arguments are expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the linearly interpolated value.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,18 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>log</c> function.
/// </summary>
/// <remarks>
/// The <c>log</c> function evaluates a numeric expression and returns its logarithm in the supplied base.
/// </remarks>
public class Log: FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>log</c>.</value>
public string Name
{
get
@ -14,6 +24,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>log</c> function.
/// </summary>
/// <value>Two numeric arguments named <c>value</c> and <c>base</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -23,6 +37,15 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>log</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the logarithm of the input value in the supplied base.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,19 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>map</c> function.
/// </summary>
/// <remarks>
/// The <c>map</c> function evaluates a numeric value from one range and returns the corresponding value in a
/// second range.
/// </remarks>
public class Map: FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>map</c>.</value>
public string Name
{
get
@ -14,6 +25,13 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>map</c> function.
/// </summary>
/// <value>
/// Five numeric arguments named <c>value</c>, <c>oldMinimum</c>, <c>oldMaximum</c>,
/// <c>newMinimum</c>, and <c>newMaximum</c>.
/// </value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -26,6 +44,16 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>map</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly five numeric arguments are expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the mapped value, or <c>0</c> when the source range has
/// equal minimum and maximum bounds.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,18 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>ln</c> function.
/// </summary>
/// <remarks>
/// The <c>ln</c> function evaluates a numeric expression and returns its natural logarithm.
/// </remarks>
public class Natural_Log: FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>ln</c>.</value>
public string Name
{
get
@ -14,6 +24,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>ln</c> function.
/// </summary>
/// <value>A single numeric argument named <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -22,6 +36,15 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>ln</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the natural logarithm of the input.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,19 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>normalize</c> function.
/// </summary>
/// <remarks>
/// The <c>normalize</c> function evaluates a numeric value and returns its position in the supplied range as a
/// zero-based ratio.
/// </remarks>
public class Normalize : FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>normalize</c>.</value>
public string Name
{
get
@ -14,6 +25,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>normalize</c> function.
/// </summary>
/// <value>Three numeric arguments named <c>value</c>, <c>minimum</c>, and <c>maximum</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -24,6 +39,16 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>normalize</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly three numeric arguments are expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the normalized ratio, or <c>0</c> when the minimum and
/// maximum bounds are equal.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,7 +4,13 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions.NumberTheory
{
/// <summary> </summary>
/// <summary>
/// Represents the standard-library <c>fib</c> function.
/// </summary>
/// <remarks>
/// The <c>fib</c> function evaluates a numeric index and returns the precomputed Fibonacci number at that index.
/// Indexes outside the supported range return <c>0</c>.
/// </remarks>
public class Fibonacci : FunctionBase, ICodedFunction
{
@ -40,6 +46,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
11825896447871834976429068427m, 19134702400093278081449423917m, 30960598847965113057878492344m,
50095301248058391139327916261m];
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>fib</c>.</value>
public string Name
{
get
@ -48,6 +58,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Gets the argument signature expected by the <c>fib</c> function.
/// </summary>
/// <value>A single numeric argument named <c>index</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -56,6 +70,16 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Executes the <c>fib</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the Fibonacci number at the supplied index, or <c>0</c>
/// when the index is outside the supported range.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -5,8 +5,19 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions.NumberTheory
{
/// <summary>
/// Represents the standard-library <c>iseven</c> function.
/// </summary>
/// <remarks>
/// The <c>iseven</c> function evaluates a numeric expression and returns <c>1</c> when the value is even;
/// otherwise, it returns <c>0</c>.
/// </remarks>
public class IsEven : FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>iseven</c>.</value>
public string Name
{
get
@ -15,6 +26,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Gets the argument signature expected by the <c>iseven</c> function.
/// </summary>
/// <value>A single numeric argument named <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -23,6 +38,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Executes the <c>iseven</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing <c>1</c> when the input value is even; otherwise <c>0</c>.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>
@ -41,8 +65,19 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Represents the standard-library <c>isodd</c> function.
/// </summary>
/// <remarks>
/// The <c>isodd</c> function evaluates a numeric expression and returns <c>1</c> when the value is odd;
/// otherwise, it returns <c>0</c>.
/// </remarks>
public class IsOdd : FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>isodd</c>.</value>
public string Name
{
get
@ -51,6 +86,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Gets the argument signature expected by the <c>isodd</c> function.
/// </summary>
/// <value>A single numeric argument named <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -59,6 +98,15 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Executes the <c>isodd</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing <c>1</c> when the input value is odd; otherwise <c>0</c>.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>
@ -72,8 +120,19 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Represents the standard-library <c>isint</c> function.
/// </summary>
/// <remarks>
/// The <c>isint</c> function evaluates a numeric expression and returns <c>1</c> when the value has no fractional
/// component; otherwise, it returns <c>0</c>.
/// </remarks>
public class IsInt : FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>isint</c>.</value>
public string Name
{
get
@ -82,6 +141,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Gets the argument signature expected by the <c>isint</c> function.
/// </summary>
/// <value>A single numeric argument named <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -90,6 +153,16 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Executes the <c>isint</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing <c>1</c> when the input value is an integer; otherwise
/// <c>0</c>.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>
@ -108,6 +181,13 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Represents the standard-library <c>isprime</c> function.
/// </summary>
/// <remarks>
/// The <c>isprime</c> function evaluates a numeric expression and returns <c>1</c> when the value is a prime
/// integer; otherwise, it returns <c>0</c>.
/// </remarks>
public class IsPrime : FunctionBase, ICodedFunction
{
private const int MaxPrimeCacheSize = 4096;
@ -135,6 +215,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
false, false, false, true, false, false, false, false, false, true,
false, false, false, false, false, false, false, true, false, false];
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>isprime</c>.</value>
public string Name
{
get
@ -143,6 +227,10 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Gets the argument signature expected by the <c>isprime</c> function.
/// </summary>
/// <value>A single numeric argument named <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -151,6 +239,16 @@ namespace CSMic.StandardLibrary.Functions.NumberTheory
}
}
/// <summary>
/// Executes the <c>isprime</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing <c>1</c> when the input value is prime; otherwise
/// <c>0</c>.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,18 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>pow</c> function.
/// </summary>
/// <remarks>
/// The <c>pow</c> function evaluates a numeric base and exponent, then returns the base raised to that exponent.
/// </remarks>
public class Power : FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>pow</c>.</value>
public string Name
{
get
@ -14,6 +24,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>pow</c> function.
/// </summary>
/// <value>Two numeric arguments named <c>base</c> and <c>exponent</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -23,6 +37,15 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>pow</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly two numeric arguments are expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the base raised to the supplied exponent.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,19 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>lerp</c> smooth-step function.
/// </summary>
/// <remarks>
/// This function evaluates a value between two edges, clamps it to the range from <c>0</c> through <c>1</c>, and
/// applies the smooth-step polynomial <c>x * x * (3 - 2 * x)</c>.
/// </remarks>
public class SmoothStep : FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>lerp</c>.</value>
public string Name
{
get
@ -14,6 +25,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>lerp</c> smooth-step function.
/// </summary>
/// <value>Three numeric arguments named <c>startEdge</c>, <c>endEdge</c>, and <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -24,6 +39,15 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>lerp</c> smooth-step function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly three numeric arguments are expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the smoothed interpolation ratio.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>

View file

@ -4,8 +4,18 @@ using System.Text;
namespace CSMic.StandardLibrary.Functions
{
/// <summary>
/// Represents the standard-library <c>sqrt</c> function.
/// </summary>
/// <remarks>
/// The <c>sqrt</c> function evaluates a numeric expression and returns its square root.
/// </remarks>
public class SquareRoot: FunctionBase, ICodedFunction
{
/// <summary>
/// Gets the expression-language name used to invoke this function.
/// </summary>
/// <value><c>sqrt</c>.</value>
public string Name
{
get
@ -14,6 +24,10 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Gets the argument signature expected by the <c>sqrt</c> function.
/// </summary>
/// <value>A single numeric argument named <c>value</c>.</value>
public override IEnumerable<FunctionArgument> ExpectedArguments
{
get
@ -22,6 +36,15 @@ namespace CSMic.StandardLibrary.Functions
}
}
/// <summary>
/// Executes the <c>sqrt</c> function.
/// </summary>
/// <param name="args">
/// The evaluated arguments supplied to the function. Exactly one numeric argument is expected.
/// </param>
/// <returns>
/// A numeric <see cref="FunctionValue"/> containing the square root of the input.
/// </returns>
public FunctionValue Execute(params FunctionArgument[] args)
{
return base.Execute(args, (_args) =>