Skip to content

Commit 931e95e

Browse files
xperiandriclaude
andcommitted
docs: Queue and IQueue in the changelog and the collection table
The changelog lists the new functions of `Queue`, the new `IQueue` module, the `Option` and `Tuple` modules and `queue { }`, the breaking changes of the `List` semantics, the queue type of the module and the patterns, the fixed `forall` and `averageBy`, and the removed `clear` and `ImmutableQueue` alias. The collection tables name `queue { }` for `Queue` and add `IQueue`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ba060e7 commit 931e95e

4 files changed

Lines changed: 36 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6767
`lastIndexOfRange`, `lastIndexOfRangeWith`, `binarySearch`, `binarySearchWithComparer`,
6868
`binarySearchRangeWithComparer`) and copies elements into an array (`blit`). `replace` throws `ArgumentException` for a
6969
value that no element equals, as the builder of an indexed list does.
70+
* `Queue` has every function of the FSharp.Core `List` module that applies to an immutable queue, over the elements in the
71+
order in which they leave the queue, with its semantics and exceptions and with stable sorts, plus `enqueueMany`,
72+
`ofReadOnlySpan`, `ofSpan`, `skipLast`, `sortWithComparer`, `takeLast`, `tryTail`, `tryUncons` and `uncons`. Its
73+
parameters and exceptions name the queues `queue`, `queue1`, `queue2`, `queue3` and `queues` where `List` names its
74+
lists. `enqueueMany`, `uncons`, `tryHead`, `tryTail` and `tryUncons` compile to `EnqueueMany`, `PeekDequeue`,
75+
`TryPeek`, `TryDequeue` and `TryPeekDequeue`, in the `IQueue`, `Option` and `Tuple` modules too. A function that takes
76+
a sequence throws `ArgumentNullException` that names the parameter for a `null` sequence and for a default `FlatList`
77+
given as a sequence, which the BCL would reject with `InvalidOperationException` while it enumerates it; the `IQueue`
78+
module and the `queue { }` expression do the same.
79+
* The `IQueue` module has the functions of `Queue` for `IImmutableQueue<'T>`, without the creation functions, plus
80+
`clear`. Its functions keep the implementation of the input queue where the result has the element type of the input,
81+
and return a `Queue` otherwise. `append` enqueues the second queue into the first one, so its result keeps the
82+
implementation of the first queue, also when that queue is empty.
83+
* The `FSharp.Collections.Immutable.Option` and `FSharp.Collections.Immutable.Tuple` namespaces have `Queue` and `IQueue`
84+
modules that repeat the functions that use value options or struct tuples with options and reference tuples.
85+
* `queue { }` builds a queue.
7086

7187
### Changed
7288

@@ -124,6 +140,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124140
* `IndexedList.rev` builds the reversed list from a reversed copy of the elements. At 100 000 integers it takes about 3 ms
125141
where `reverse`, which called `ImmutableList.Reverse`, took about 23 ms, and it allocates 5.2 MB where `reverse`
126142
allocated 4.8 MB.
143+
* `Queue` works on `Queue<'T>` (`ImmutableQueue<'T>`) instead of `IQueue<'T>`, and `enqueue`, `tail` and `filter` return a
144+
`Queue<'T>`; the functions for `IImmutableQueue<'T>` are in the new `IQueue` module.
145+
* `Queue`: `tryFind`, `tryFindIndex` and `tryPick` return `voption`, and `pick` and `tryPick` take functions that return
146+
`voption`. The complete active pattern `Cons | Nil`, whose `Cons` case matched a reference tuple of the head and the
147+
tail, is replaced by the struct partial active patterns `Cons`, which matches a struct tuple of the head and the tail,
148+
and `Nil`.
149+
* `Queue`: every function throws what the FSharp.Core `List` function of the same name throws. `head` and `tail` of an
150+
empty queue throw `ArgumentException`, where they threw `InvalidOperationException`, and `iter2` of queues of
151+
different lengths throws `ArgumentException`, where it stopped at the shorter queue. A default `FlatList` given as a
152+
sequence to `ofSeq` throws `ArgumentNullException`, where it threw `InvalidOperationException`.
153+
* `Queue.forall` and `Queue.averageBy` apply to the queue; they returned a function of a sequence before.
154+
* `Queue`: `enqueue`, `head` and `tail` compile to `Enqueue`, `Peek` and `Dequeue`, and the other functions to
155+
PascalCase names such as `IsEmpty`, where 1.0.0 compiled all of them under their F# names, such as `isEmpty`.
127156

128157
### Removed
129158

@@ -161,6 +190,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
161190
* The `IndexedSeq` module and the `IIndexedSeq<'T>` abbreviation of `IReadOnlyList<'T>`: use `IReadOnlyList<'T>`, whose
162191
`Count` and indexer replace `IndexedSeq.length` and `IndexedSeq.item`. `IndexedSeq.check` needs no replacement, because
163192
every function of the list modules throws `ArgumentNullException` for a `null` list.
193+
* `Queue.clear`: use `Queue.empty`, or `IQueue.clear` to keep the implementation of an interface value.
164194

165195
## [1.0.0] - 2020-02-23
166196

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Please also join the [F# Open Source Group](http://fsharp.github.com)
1616
| `IndexedList` | `ImmutableList<'T>` | `indexedList { }` |
1717
| `IIndexedList` | `IImmutableList<'T>` | – |
1818
| `Stack` | `ImmutableStack<'T>` | – |
19-
| `Queue` | `ImmutableQueue<'T>` | – |
19+
| `Queue` | `ImmutableQueue<'T>` | `queue { }` |
20+
| `IQueue` | `IImmutableQueue<'T>` | – |
2021
| `HashMap` | `ImmutableDictionary<'Key, 'Value>` | – |
2122
| `SortedMap` | `ImmutableSortedDictionary<'Key, 'Value>` | – |
2223
| `HashSet` | `ImmutableHashSet<'T>` | – |

‎docsSrc/Explanations/Background.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ While F# has its own built-in immutable collections, System.Collections.Immutabl
3030
| `IndexedList` | `ImmutableList<'T>` | `indexedList { }` |
3131
| `IIndexedList` | `IImmutableList<'T>` | – |
3232
| `Stack` | `ImmutableStack<'T>` | – |
33-
| `Queue` | `ImmutableQueue<'T>` | – |
33+
| `Queue` | `ImmutableQueue<'T>` | `queue { }` |
34+
| `IQueue` | `IImmutableQueue<'T>` | – |
3435
| `HashMap` | `ImmutableDictionary<'Key, 'Value>` | – |
3536
| `SortedMap` | `ImmutableSortedDictionary<'Key, 'Value>` | – |
3637
| `HashSet` | `ImmutableHashSet<'T>` | – |

‎docsSrc/index.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ F# bindings for [System.Collections.Immutable](https://learn.microsoft.com/en-us
1212
| `IndexedList` | `ImmutableList<'T>` | `indexedList { }` |
1313
| `IIndexedList` | `IImmutableList<'T>` | – |
1414
| `Stack` | `ImmutableStack<'T>` | – |
15-
| `Queue` | `ImmutableQueue<'T>` | – |
15+
| `Queue` | `ImmutableQueue<'T>` | `queue { }` |
16+
| `IQueue` | `IImmutableQueue<'T>` | – |
1617
| `HashMap` | `ImmutableDictionary<'Key, 'Value>` | – |
1718
| `SortedMap` | `ImmutableSortedDictionary<'Key, 'Value>` | – |
1819
| `HashSet` | `ImmutableHashSet<'T>` | – |

0 commit comments

Comments
 (0)