Skip to content

Commit 1e6c10a

Browse files
Add empty seq example, doc links (#44)
1 parent 5c07791 commit 1e6c10a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

docs/fsharp-cheatsheet.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ See [Statically Resolved Type Parameters (MS Learn)](https://learn.microsoft.com
352352

353353
## Lists
354354

355-
A *list* is an immutable collection of elements of the same type. Implemented internally as a linked list.
355+
*Lists* are immutable collections of elements of the same type; implemented internally as a linked list.
356356

357357
```fsharp
358358
// Create
@@ -383,13 +383,13 @@ let rec sumEachItem' (acc:int) (myList:int list) =
383383
let sumEachItem (myList:int list) = sumEachItem' 0 myList
384384
```
385385

386-
See the [List Module](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-listmodule.html) for built-in functions.
386+
See [Lists (MS Learn)](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/lists) to learn more. See the [List Module](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-listmodule.html) for built-in functions.
387387

388388
<div id="collections-arrays"></div>
389389

390390
## Arrays
391391

392-
*Arrays* are fixed-size, zero-based, collections of consecutive data elements maintained as one block of memory. They are *mutable*; individual elements can be changed.
392+
*Arrays* are fixed-size, zero-based collections of consecutive data elements maintained as one block of memory. They are *mutable*; individual elements can be changed.
393393

394394

395395
```fsharp
@@ -416,24 +416,24 @@ match myArray with
416416
| [| _; 4 |] -> ... // match array with 2 items, second item = 4
417417
```
418418

419-
See the [Array Module](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-arraymodule.html) for built-in functions.
419+
See [Arrays (MS Learn)](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/arrays) to learn more. See the [Array Module](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-arraymodule.html) for built-in functions.
420420

421421
<div id="collections-sequences"></div>
422422

423423
## Sequences
424424

425-
A *sequence* is a logical series of elements of the same type. `seq<'t>` is an alias for [`System.Collections.Generic.IEnumerable<'t>`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1).
425+
A *sequence* is a logical series of elements of the same type. Sequences are lazily evaluated, and individual elements are computed only as required. `seq<'t>` is an alias for [`System.Collections.Generic.IEnumerable<'t>`](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1).
426426

427427
```fsharp
428-
// Create
428+
let emptySeq : int seq = seq { } // empty works as of F# 9
429429
let seq1 = { 1; 2 }
430430
let seq2 = seq {
431431
1
432432
2 }
433433
let seq3 = seq { 1..2..9 } // start..increment..last; 1,3,5,7,9
434434
```
435435

436-
See the [Seq Module](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-seqmodule.html) for built-in functions.
436+
See [Sequences (MS Learn)](https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/sequences) to learn more. See the [Seq Module](https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-seqmodule.html) for built-in functions.
437437

438438
## Collection comprehension
439439

0 commit comments

Comments
 (0)