asc-community / HonkSharp

Some wrappers and API and methods for fast and convenient declarative coding in C#
47 stars 4 forks source link

`.With` #2

Closed WhiteBlackGoose closed 3 years ago

WhiteBlackGoose commented 3 years ago

For local variables. For example,

5
.With(out var sqr, 5 * 5)
.Join(sqr)
.Apply((a, sqr) => sqr + a / sqr)

(omg it's sooooooo sweet)

WhiteBlackGoose commented 3 years ago

Join -> Inject A more advanced example:

5
.With(out var sqr, 5 * 5)
.Inject(sqr)
.Apply((a, sqr) => sqr + a * sqr)
.Apply(a => a + 2)
.Apply(a => a / 6)
.Inject(sqr + 3)
.Apply((a, newSqr) => a < 0) switch
{
    true => false,
    false => true
};
WhiteBlackGoose commented 3 years ago

It's Let