Learning F# Functional Data Structures and Algorithms by 2015

Learning F# Functional Data Structures and Algorithms by 2015

Author:2015
Language: eng
Format: mobi, epub
Publisher: Packt Publishing


Now, based on these lists, we can perform simple query operations such as finding out the books published in the year 2005. If you are familiar with LINQ in C#, this syntax will look very similar to you:

query { for pl in ProgrammingLanguages do where (pl.publishYear = 2005) select (pl.ToString()) } > val it : seq<string> = seq ["F# (2005)"]

As you have noticed, in the query expressions, the select keyword performs the same function as yield does in a sequence expression. Along with the select keyword, F# supports a variety of query operators that look very similar to SQL SELECT statements. However, our main interest here is to figure out how to do paging using the query. For this purpose, we use the skip and take operators of the query expression:

let getPLPageBySize pageSize pageNumber = query { for pl in ProgrammingLanguages do skip (pageSize * (pageNumber - 1)) take pageSize select (pl.ToString())}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.