LanguageExt 0.0.8-beta
See the version list below for details.
dotnet add package LanguageExt --version 0.0.8-beta
NuGet\Install-Package LanguageExt -Version 0.0.8-beta
<PackageReference Include="LanguageExt" Version="0.0.8-beta" />
paket add LanguageExt --version 0.0.8-beta
#r "nuget: LanguageExt, 0.0.8-beta"
// Install LanguageExt as a Cake Addin
#addin nuget:?package=LanguageExt&version=0.0.8-beta&prerelease
// Install LanguageExt as a Cake Tool
#tool nuget:?package=LanguageExt&version=0.0.8-beta&prerelease
Using and abusing the features of C# 6 to provide lots of functions and types, which, if you squint, can look like extensions to the language itself.
This package brings functional helpers for classic C# problems:
Poor tuple support
Null reference problem
Lack of lambda and expression inference
Void isn't a real type
Mutable lists and dictionaries
The awful 'out' parameter
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
.NETFramework 4.5
- System.Collections.Immutable (>= 1.1.32-beta)
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.2-beta | 103 | 4/16/2015 |
0.1.1-beta | 66 | 2/19/2015 |
0.0.14-beta | 40 | 2/4/2015 |
0.0.12-beta | 42 | 1/15/2015 |
0.0.11-beta | 35 | 1/15/2015 |
0.0.10-beta | 38 | 1/15/2015 |
0.0.8-beta | 123 | 11/23/2014 |
0.0.7-beta | 64 | 11/22/2014 |
0.0.6-beta | 65 | 11/22/2014 |
0.0.4-beta | 71 | 11/21/2014 |
0.0.3-beta | 124 | 11/20/2014 |
0.0.2-beta | 193 | 11/19/2014 |
0.0.1-beta | 262 | 11/19/2014 |
## List matching
Improved list matching. There are many more overrides for deconstructing the head items from a list (up to six elements). e.g.
// The fewest number of elements deconstructed
int Product(IEnumerable<int> list) =>
match(list,
() => 1,
(x, xs) => x * Product(xs));
// The most
int GetLength(IEnumerable<int> list) =>
match(
lst,
() => 0,
a => 1,
(a, b) => 2,
(a, b, c) => 3,
(a, b, c, d) => 4,
(a, b, c, d, e) => 5,
(a, b, c, d, e, f) => 6,
(x, xs) => xs.Count() + 1
);
Also, a `null` list is considered empty.
## range
Additional `range()` variants:
* Ranges with different step sizes - `range(0,100,10)`
* range of ranges - `range( range(0,100), range(200,100) )`
* range of chars - `range('a','z')`
## List
Additional functions:
* `repeat`
* `init` - generate a sequence where each step calls a generator function with the index
* `initInfinite`
* `choose`
* `collect`
* `scan`
* `scanBack`
* `find`
* `distinct`
* `take`
* `takeWhile`
* `unfold`
* `exists`
__Breaking changes__
* `foldr` renamed `foldBack`
* Removed the variants of `map` and `iter` (`mapi` and `iteri`) and just used overloading instead
* Fluent variants now use Pascal Case naming
## Map
Additional function:
* `exists`
__Breaking changes__
* `contains` renamed `containsKey`
* Fluent variants now use Pascal Case naming
## Set
Additional functions:
* `add`
* `compare`
* `length`
* `difference`
* `exists`
* `filter`
* `intersect`
* `map`
* `contains`
* `remove`
* `isSubset`
* `isProperSubset`
## Tuple
__Breaking change__
* Removed `this` from `with`, they shouldn't be extension methods because `With` is already performing that duty.
## Assorted updates
* `convert` returns `Option<T>`
* Added `TryGetValue` for `ImmutableDictionary` and `ImmutableSet`
* Added `AsEnumerable()` extension to `Nullable<T>`
* Functions for converting IEnumerable to immutable collections: `toList`, `toArray`, `toSet`, `toQueue`, `toStack`