You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4e7ae81
Browse filesBrowse the repository at this point in the historyBrowse files
fixup! feat: Queue and IQueue modules with the vocabulary of the FSharp.Core List module
Follows the review of #33 and ADR 0001 (D6, D7, D14):
- `sort`, `sortByDescending`, `sortDescending` and `sortWith` of `Queue` and `IQueue` sort with the `Seq` functions of
FSharp.Core, which share the stable sort of `List`, so that a comparison or a projection that throws throws what `List`
throws. LINQ already wrapped the exception of a comparison in an `InvalidOperationException`, as `Array.Sort` does.
`OrderByDescending` differed for the projection, which `List.sortByDescending` calls inside the comparison. `sortBy`
and `sortWithComparer` keep LINQ.
- `sortDescending` and `sortByDescending` call `Seq.sortWith` with the cached comparer of F# generic comparison, through
the new `Queues.sortDescending` and `Queues.sortByDescending`. `Seq.sortDescending` and `Seq.sortByDescending` are
inline: inside a generic function they compare with the generic operator, which boxes the elements of a value type in
every comparison. For 10 000 integers, they allocate 7.8 MB per call instead of 0.74 MB.
- At 10 000 integers, `sortWith` takes about the same time as before and allocates 743 KB per call instead of 440 KB.
- `QueueCE.fsi` carries the signatures and the documentation of `QueueCE`, compiled right before it. `queue` has its
`val` and its example in `ComputationExpressions.fsi`, after `indexedList`, and only the binding stays in the `.fs`.
- `queue { yield! ... }` rejects a null sequence, array or queue with `ArgumentNullException` for the parameter `items`.
- The remarks of `IQueue.append` say that the result keeps the implementation of the first queue, which receives the
elements (D14), also when that queue is empty.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
0 commit comments