CSBiology / FSharpAux

Auxiliary functions and data structures for the F# programming language
MIT License
23 stars 16 forks source link

[BUG] `Seq.groupWhen` returning incorrect results #17

Closed omaus closed 2 years ago

omaus commented 2 years ago

Description

Seq.groupWhen returns incorrect results under specific circumstances (s. below).

Repro steps

  1. Copy
    
    #r "nuget: FSharpAux"
    open FSharpAux

let testArr = [| 3 3 2 4 1 2 1 |]

let isOdd n = n % 2 <> 0

Seq.groupWhen isOdd testArr


2. Execute

### Expected behavior

```f#
val it : seq<seq<int>> = seq [[3]; [3; 2; 4]; [1; 2]; [1]]

Actual behavior

val it : seq<seq<int>> = seq [[3]; [3; 2; 4]; [1; 2; 1]]

Last item is not grouped alone even if it should be.

Known workarounds

n/a

Related information