magic.lambda.math 14.0.0

.NET Standard 2.0
Install-Package magic.lambda.math -Version 14.0.0
dotnet add package magic.lambda.math --version 14.0.0
<PackageReference Include="magic.lambda.math" Version="14.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add magic.lambda.math --version 14.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: magic.lambda.math, 14.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install magic.lambda.math as a Cake Addin
#addin nuget:?package=magic.lambda.math&version=14.0.0

// Install magic.lambda.math as a Cake Tool
#tool nuget:?package=magic.lambda.math&version=14.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Math slots in Hyperlambda

This project provides math functions to Magic. More specifically, it provides the following slots.

  • [math.multiply] - Multiplication
  • [math.divide] - Division
  • [math.add] - Addition
  • [math.subtract] - Subtraction
  • [math.modulo] - Modulo
  • [math.decrement] - Decrements a node's value, optionally by [step], defaulting to 1
  • [math.increment] - Increments a node's value, optionally by [step], defaulting to 1

All of the above besides the two last slots can be given any number of arguments, including as its value, and will treat the first argument as the "base", and performing the rest of the arguments self assigning the base as it proceeds. For instance, the following code will first divide 100 by 4, then divide that result by 5 again, resulting in 5.

math.divide:int:100
   :int:4
   :int:5

The value of the above [math.divide] node after evaluating the above Hyperlambda will be 5. All of the above slots will also evaluate the children collection as a lambda, before starting the actual math function, allowing you to recursively raise signals to retrieve values that are supposed to be mathematically handled somehow. This allows you to recursively nest math operations, such as for instance.

.one:int:5
.two:int:2

math.multiply
   .:int:3
   math.add
      get-value:x:@.one
      get-value:x:@.two

The above of course will first add 5 and 2, then multiple the result of that with 3, resulting in 21.

Incrementing and decrementing values

The above [math.increment] and [math.decrement] slots, will instead of yielding a result, inline modify the value of the node(s) it is pointing to, assuming its value is an expression. In addition these two slots can take an optional "step" argument, allowing you to declare how much the incrementation/decrementation process should add/reduce the original node's value by. Below is an example that decrements the value found in its expression by 2.

.value:int:5

math.decrement:x:-
   .:int:2

After executing the above, the result of [.value] will be 3. The default "step" value if ommitted will be 1. Below is an example.

.value:int:5

math.increment:x:-

Notice - You can use any slot invocation to retrieve the step value for the increment/decrement slots, including for instance an invocation to [get-value], or your custom slots. This is dues to that the first argument supplied to these slots will be assumed to be the "step" value you want.

Modulo

The modulo slot divides its argument(s) by its base, and returns the remainder.

.int:17

math.modulo:x:-
   .:int:10

The above results in 7.

Project website

The source code for this repository can be found at github.com/polterguy/magic.lambda.math, and you can provide feedback, provide bug reports, etc at the same place.

Quality gates

  • Build status
  • Quality Gate Status
  • Bugs
  • Code Smells
  • Coverage
  • Duplicated Lines (%)
  • Lines of Code
  • Maintainability Rating
  • Reliability Rating
  • Security Rating
  • Technical Debt
  • Vulnerabilities
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on magic.lambda.math:

Package Downloads
magic.library

Helper project for Magic to wire up everything easily by simply adding one package, and invoking two simple methods. When using Magic, this is (probably) the only package you should actually add, since this package pulls in everything else you'll need automatically, and wires up everything sanely by default. To use package go to https://polterguy.github.io

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
14.0.0 52 6/25/2022
13.4.0 484 5/31/2022
13.3.4 363 5/9/2022
13.3.0 204 5/1/2022
13.2.0 256 4/21/2022
13.1.0 263 4/7/2022
13.0.0 126 4/5/2022
11.0.5 433 3/2/2022
11.0.4 170 2/22/2022
11.0.3 182 2/9/2022
11.0.2 192 2/6/2022
11.0.1 150 2/5/2022
10.0.21 164 1/28/2022
10.0.20 160 1/27/2022
10.0.19 152 1/23/2022
10.0.18 135 1/17/2022
10.0.15 364 12/31/2021
10.0.14 226 12/28/2021
10.0.7 644 12/22/2021
10.0.5 321 12/18/2021
9.9.9 1,028 11/29/2021
9.9.3 349 11/9/2021
9.9.2 255 11/4/2021
9.9.0 372 10/30/2021
9.8.9 316 10/29/2021
9.8.7 283 10/27/2021
9.8.6 272 10/27/2021
9.8.5 315 10/26/2021
9.8.0 690 10/20/2021
9.7.9 292 10/19/2021
9.7.8 265 10/19/2021
9.7.5 662 10/14/2021
9.7.0 405 10/9/2021
9.6.6 625 8/14/2021
9.2.0 3,588 5/26/2021
9.1.4 619 4/21/2021
9.1.0 461 4/14/2021
9.0.0 406 4/5/2021
8.9.9 518 3/30/2021
8.9.3 801 3/19/2021
8.9.2 506 1/29/2021
8.9.1 495 1/24/2021
8.9.0 584 1/22/2021
8.6.9 1,798 11/8/2020
8.6.6 1,074 11/2/2020
8.6.0 2,123 10/28/2020
8.5.0 982 10/23/2020
8.4.0 3,078 10/13/2020
8.3.1 1,457 10/5/2020
8.3.0 679 10/3/2020
8.2.2 1,101 9/26/2020
8.2.1 704 9/25/2020
8.2.0 741 9/25/2020
8.1.19 1,754 9/21/2020
8.1.18 700 9/15/2020
8.1.17 1,899 9/13/2020
8.1.16 344 9/13/2020
8.1.15 991 9/12/2020
8.1.11 1,360 9/11/2020
8.1.10 743 9/6/2020
8.1.9 695 9/3/2020
8.1.8 683 9/2/2020
8.1.7 575 8/28/2020
8.1.4 597 8/25/2020
8.1.3 662 8/18/2020
8.1.2 610 8/16/2020
8.1.1 694 8/15/2020
8.1.0 322 8/15/2020
8.0.1 1,475 8/7/2020
8.0.0 628 8/7/2020
7.0.1 730 6/28/2020
7.0.0 631 6/28/2020
5.0.0 4,190 2/25/2020
4.0.4 4,385 1/27/2020
4.0.3 695 1/27/2020
4.0.2 787 1/16/2020
4.0.1 775 1/11/2020
4.0.0 719 1/5/2020
3.1.0 3,623 11/10/2019
3.0.0 2,209 10/23/2019
2.0.1 5,009 10/15/2019
2.0.0 889 10/13/2019
1.1.8 716 10/11/2019
1.1.7 684 10/10/2019
1.1.6 323 10/9/2019
1.1.5 316 10/6/2019
1.1.4 309 10/6/2019
1.1.3 303 10/5/2019
1.1.2 313 10/5/2019
1.0.0 349 9/26/2019