Skip to content

Commit

Permalink
[FSharp] Add List.intersperse
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Jul 24, 2024
1 parent de3f5ac commit b89f5ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Aardvark.Base.FSharp/Utilities/Interop/FSLibExtensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ module Prelude =

acc

/// Inserts a separator in between the elements of the given list.
let inline intersperse (separator: 'T) (list: 'T list) =
(list, []) ||> List.foldBack (fun x -> function
| [] -> [x]
| xs -> x::separator::xs
)

module Array =

let inline foldi (folder : int -> 'State -> 'T -> 'State) (state : 'State) (array : 'T[]) =
Expand Down

0 comments on commit b89f5ee

Please sign in to comment.