Funtom.Linq 0.0.5

Install-Package Funtom.Linq -Version 0.0.5
dotnet add package Funtom.Linq --version 0.0.5
<PackageReference Include="Funtom.Linq" Version="0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Funtom.Linq --version 0.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Funtom.Linq, 0.0.5"
#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 Funtom.Linq as a Cake Addin
#addin nuget:?package=Funtom.Linq&version=0.0.5

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

img

Funtom.Linq

Funtom.Linq is a library for F# that is compatible with System.Linq.
This library makes it easier to use pipeline operators and optimizes for FSharp.Core.List<'T> and more.

Naming rules

The method names defined in System.Linq are redefined in camelCase.
For example, 'Select' becomes 'select', and 'ToList' becomes 'toList'.

Usage

In this section, I will show you how to use the System.Linq 'Where' and 'Select' method as an example.

  1. When using System.Linq

    open System.Linq
    
    let xs =
      [ 0..10 ]
        .Where ((>) 5)
        .Select ((*) 2)
    
  2. When using Funtom.Linq

    #r "nuget: Funtom.Linq"
    open Funtom.Linq
    
    let xs =
      [ 0..10 ]
      |> Linq.where ((>) 5)
      |> Linq.select ((*) 2)
    

Performance

Funtom.Linq is intended to be implemented in such a way that its performance is almost equal to or better than that of System.Linq.
Let's compare the performance of 'Select'.

  let xs = [ 0 .. 10000 ]
  let ys = [| 0 .. 10000 |]
  let zs = ResizeArray([| 0 .. 10000 |])
  let ss = seq { 0 .. 10000 }

  [<Benchmark>]
  member __.Fsharp_Seq_map_fslist() = xs |> Seq.map ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Funtom_select_fslist() = xs |> Linq.select ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Linq_Select_fslist() = xs.Select((*) 2).ToArray()
  
  [<Benchmark>]
  member __.Fsharp_Seq_map_array() = ys |> Seq.map ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Funtom_select_array() = ys |> Linq.select ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Linq_Select_array() = ys.Select((*) 2).ToArray()
  
  [<Benchmark>]
  member __.Fsharp_Seq_map_resizearry() = zs |> Seq.map ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Funtom_select_resizearry() = zs |> Linq.select ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Linq_Select_resizearry() = zs.Select((*) 2).ToArray()

  [<Benchmark>]
  member __.Fsharp_Seq_map_seq() = ss |> Seq.map ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Funtom_select_seq() = ss |> Linq.select ((*) 2) |> Linq.toArray

  [<Benchmark>]
  member __.Linq_Select_seq() = ss.Select((*) 2).ToArray()

Result:
image

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.5 46 1/4/2022
0.0.4 35 1/3/2022
0.0.3 40 12/31/2021
0.0.2 61 12/12/2021
0.0.1 237 12/11/2021