magic.lambda.math
10.0.18
InstallPackage magic.lambda.math Version 10.0.18
dotnet add package magic.lambda.math version 10.0.18
<PackageReference Include="magic.lambda.math" Version="10.0.18" />
paket add magic.lambda.math version 10.0.18
#r "nuget: magic.lambda.math, 10.0.18"
// Install magic.lambda.math as a Cake Addin
#addin nuget:?package=magic.lambda.math&version=10.0.18
// Install magic.lambda.math as a Cake Tool
#tool nuget:?package=magic.lambda.math&version=10.0.18
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
getvalue:x:@.one
getvalue: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 [getvalue], 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

.NETStandard 2.0
 magic.node.extensions (>= 10.0.18)
 magic.signals.contracts (>= 10.0.18)
 Microsoft.CSharp (>= 4.7.0)
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 

10.0.18  0  1/17/2022 
10.0.15  195  12/31/2021 
10.0.14  98  12/28/2021 
10.0.7  401  12/22/2021 
10.0.5  189  12/18/2021 
9.9.9  979  11/29/2021 
9.9.3  291  11/9/2021 
9.9.2  208  11/4/2021 
9.9.0  309  10/30/2021 
9.8.9  235  10/29/2021 
9.8.7  232  10/27/2021 
9.8.6  213  10/27/2021 
9.8.5  250  10/26/2021 
9.8.0  572  10/20/2021 
9.7.9  240  10/19/2021 
9.7.8  209  10/19/2021 
9.7.5  549  10/14/2021 
9.7.0  355  10/9/2021 
9.6.6  562  8/14/2021 
9.2.0  3,200  5/26/2021 
9.1.4  555  4/21/2021 
9.1.0  405  4/14/2021 
9.0.0  323  4/5/2021 
8.9.9  388  3/30/2021 
8.9.3  585  3/19/2021 
8.9.2  402  1/29/2021 
8.9.1  356  1/24/2021 
8.9.0  410  1/22/2021 
8.6.9  1,527  11/8/2020 
8.6.6  827  11/2/2020 
8.6.0  1,625  10/28/2020 
8.5.0  755  10/23/2020 
8.4.0  2,302  10/13/2020 
8.3.1  1,130  10/5/2020 
8.3.0  516  10/3/2020 
8.2.2  863  9/26/2020 
8.2.1  539  9/25/2020 
8.2.0  574  9/25/2020 
8.1.19  1,339  9/21/2020 
8.1.18  548  9/15/2020 
8.1.17  1,448  9/13/2020 
8.1.16  280  9/13/2020 
8.1.15  738  9/12/2020 
8.1.11  1,027  9/11/2020 
8.1.10  557  9/6/2020 
8.1.9  543  9/3/2020 
8.1.8  550  9/2/2020 
8.1.7  452  8/28/2020 
8.1.4  449  8/25/2020 
8.1.3  478  8/18/2020 
8.1.2  494  8/16/2020 
8.1.1  557  8/15/2020 
8.1.0  263  8/15/2020 
8.0.1  1,167  8/7/2020 
8.0.0  477  8/7/2020 
7.0.1  595  6/28/2020 
7.0.0  486  6/28/2020 
5.0.0  3,292  2/25/2020 
4.0.4  3,409  1/27/2020 
4.0.3  551  1/27/2020 
4.0.2  612  1/16/2020 
4.0.1  629  1/11/2020 
4.0.0  578  1/5/2020 
3.1.0  2,813  11/10/2019 
3.0.0  1,701  10/23/2019 
2.0.1  3,845  10/15/2019 
2.0.0  746  10/13/2019 
1.1.8  561  10/11/2019 
1.1.7  538  10/10/2019 
1.1.6  262  10/9/2019 
1.1.5  264  10/6/2019 
1.1.4  255  10/6/2019 
1.1.3  247  10/5/2019 
1.1.2  258  10/5/2019 
1.0.0  277  9/26/2019 