Query expressions

To retrieve a selective number of elements through a sequence, or page through the sequence, a query expression is used. Query expressions allow us to query a data source and put the results in the desired form. Query expressions provide support for LINQ in F#. A typical use case of pagination is a retail location grid where we see 10-20 stores at a time, based on search criteria. This search of elements can later be expanded based on users' selection of the page number.

As a computation expression, query expressions are similar to sequences. Just like sequences, where to populate a sequence you provide code in a sequence expression, for query expression you specify a predicate, a selection query, or similar code.

To understand ...

Get Learning F# Functional Data Structures and Algorithms now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.