Simplee.Intelligence.Common 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Simplee.Intelligence.Common --version 1.0.4                
NuGet\Install-Package Simplee.Intelligence.Common -Version 1.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Simplee.Intelligence.Common" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Simplee.Intelligence.Common --version 1.0.4                
#r "nuget: Simplee.Intelligence.Common, 1.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Simplee.Intelligence.Common as a Cake Addin
#addin nuget:?package=Simplee.Intelligence.Common&version=1.0.4

// Install Simplee.Intelligence.Common as a Cake Tool
#tool nuget:?package=Simplee.Intelligence.Common&version=1.0.4                

Simplee.Intelligence.Common

Library which implements common operations on random numbers and sequences.

Sequence Extensions

The library adds the foldt function which implements the a fold operation which can be terminated before the source sequence is fully parsed. The distinctN function, also imlemented in by this library, is based on foldt, and returns a list of n distinct values from a given source.

open Simplee

let stp lst v = 
    match v::lst with
    | lst when lst |> List.length >= 3 -> Seq.FoldDone lst
    | lst                              -> Seq.FoldContinue lst

[1;2;3;4;5] |> Seq.foldt stp [] |> List.rev |> printfn "Res: %A"
// > Res: [1; 2; 3]

[1;2;1;2;3;1;4;5;6] |> Seq.distinctN 4 |> List.rev |> printfn "Res: %A"
// > Res: [1; 2; 3; 4]

Random Monad

The library implements under the Simplee.Intelligence.Random namespace the Rnd monad which allows you to easily create flows which involve computation using random values. The Simplee.Intelligence.Random namespaces provide the unfold function which generates lazy sequences based on random numbers.

open Simplee.Intelligence.Random
open Simplee.Intelligence.Random.Distributions
open Simplee.Intelligence.Random.Extensions

// The state is a pair of integer and string values.
// At each step we generate a random sequece of 5 bit-values, 
// while incrementing the integer value in the internal state.
// The true flag passed to unfold function indicates that at each
// step, the random uniform sequence is generated using a new random seed.
let step (i, s) =
    Rnd.discreteUniformSeq 0 1
    |> Rnd.map (fun xs -> xs |> Seq.take 5)
    |> Rnd.map (fun r -> r, (i + 1, s))
    |> Rnd.map Some

let test seed zero =
    zero
    |> Rnd.unfold true step
    |> Rnd.map (Seq.take 10)
    |> Rnd.evalWithSeed seed
    |> Seq.iteri (fun i xs -> printfn "%d: %A" i xs)

test 0 (0, "a")

// 0: seq [1; 1; 0; 0; ...]
// 1: seq [1; 1; 1; 1; ...]
// 2: seq [1; 0; 0; 0; ...]
// ...
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Simplee.Intelligence.Common:

Package Downloads
Simplee.Intelligence.Distributed

FSharp library which implements distributed algorithms using MailboxProcessor.

GitHub repositories

This package is not used by any popular GitHub repositories.

Add the unfold mechanism for random sequences.