mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-10 16:28:41 +00:00
Plumb generic metadata through (#107)
This commit is contained in:
22
WoofWare.PawPrint.Domain/ImmutableArray.fs
Normal file
22
WoofWare.PawPrint.Domain/ImmutableArray.fs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace WoofWare.PawPrint
|
||||
|
||||
open System.Collections.Immutable
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
module internal ImmutableArray =
|
||||
|
||||
let inline map ([<InlineIfLambda>] f : 'a -> 'b) (arr : ImmutableArray<'a>) : ImmutableArray<'b> =
|
||||
let b = ImmutableArray.CreateBuilder ()
|
||||
|
||||
for i in arr do
|
||||
b.Add (f i)
|
||||
|
||||
b.ToImmutable ()
|
||||
|
||||
let inline mapi ([<InlineIfLambda>] f : int -> 'a -> 'b) (arr : ImmutableArray<'a>) : ImmutableArray<'b> =
|
||||
let b = ImmutableArray.CreateBuilder ()
|
||||
|
||||
for i = 0 to arr.Length - 1 do
|
||||
b.Add (f i arr.[i])
|
||||
|
||||
b.ToImmutable ()
|
Reference in New Issue
Block a user