Expert F# 3.0

3rd Edition

By Don Syme , Adam Granicz , Antonio Cisternino

Expert F# 3.0 Cover Image

Expert F# 3.0 is about practical programming in a beautiful language that puts the power and elegance of data-rich functional programming into the hands of professional developers and analytical programmers. Through simplicity and interoperability, F# achieves unrivaled levels of programmer productivity, application performance and program clarity.

Full Description

  • ISBN13: 978-1-4302-4650-3
  • 638 Pages
  • User Level: Intermediate to Advanced
  • Publication Date: November 5, 2012
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $69.99
  • eBook Price: $48.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Expert F# 3.0 is about practical programming in a beautiful language that puts the power and elegance of data-rich functional programming into the hands of professional developers. In combination with .NET, F# achieves unrivaled levels of programmer productivity and program clarity.

Expert F# 3.0 is:

  • A comprehensive guide to F# by the inventor of F#
  • A treasury of F# techniques for practical problem-solving
  • An in-depth case book of how F# applications and of F# 3.0 concepts, syntax, and features

F# isn't just another functional programming language. It's a general-purpose language ideal for solving real-world development problems. F# seamlessly integrates functional, imperative, object-oriented and query programming styles so you can flexibly and elegantly solve any programming problem. F# 3.0 combines this with the seamless data-integration capabilities of F# Information-Rich Programming. Whatever your background, you’ll find that F# is easy to learn, fun to use, and extraordinarily powerful. F# will change the way you think about—and go about—programming.

Written by F#'s inventor and two major F# community members, Expert F# 3.0 is a comprehensive and in-depth guide to the language and its use. Designed to help others become experts, the book quickly yet carefully describes the paradigms supported by F# language, and then shows how to use F# elegantly for a practical web, data, parallel and analytical programming tasks.

The world's experts in F# show you how to program in F# the way they do!

What you’ll learn

  • Explore F# and its features quickly and thoroughly in the introductory chapters
  • Use F# with matching technologies including SQL, LINQ, ASP.NET and REST
  • Build reactive, asynchronous, and distributed web applications with F#
  • Interoperate with F# from other languages, especially C#
  • Integrate data sources and services using F# 3.0 Information-Rich Programming
  • Test, profile, and performance tune F# applications
  • Create mobile applications, both web and native

Who this book is for

Expert F# 3.0 is for anyone interested in state-of-the-art programming for solving real-world problems. Programmers of all backgrounds will find it engrossing. For C#, Java and VB programmers, F# provides invaluable insights into the future of these languages. For lovers of Python, Ruby and other dynamic languages, F# shows how you can get most of the benefits of these languages while keeping strong types and good performance. For educators, F# is the answer to a decades-long prayer: a language based on strong computer science concepts that also excites and empowers, not just in the classroom, but also in the real world.

Table of Contents

Table of Contents

1. Introduction

2. Your First F# Program – Getting Started With F#

3. Introducing Functional Programming

4. Introducing Imperative Programming

5. Understanding Types in Functional Programming

6. Programming with Objects

7. Encapsulating and Organizing Your Code

8. Working with Textual Data

9. Working with Sequences and Structured Data

10. Numeric Programming and Charting

11. Reactive, Asynchronous, and Parallel Programming

12. Symbolic Programming with Structured Data

13. Integrating External Data and Services

14. Building Smart Web Applications

15. Building Mobile Web Applications

16. Visualization and Graphical User Interfaces

17. Language-Oriented Programming: Advanced Techniques

18. Libraries and Interoperating with Other Languages

19. Packaging, Debugging and Testing F# Code

20. Designing F# Libraries

21. Appendix

Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page 98:
You can also apply this technique to the earlier HCF algorithm:

let hcfGeneric (ops : INumeric<'T>) =
let rec hcf a b =
if a = ops.Zero then b
elif ops.LessThan(a, b) then hcf a (ops.Subtract(b, a))
else hcf (ops.Subtract(a, b)) b
hcf

Should be:

let inline hcf a b =
let rec loop a b =
if a = LanguagePrimitives.GenericZero<_> then b
elif a < b then loop a (b - a)
else loop (a - b) b
loop a b

On page 354:
Listing 14-1 - the Line |GET/HTTP/1.0| below gives an error: expected to have unit->string and instead is a string.

The source code for this chapter also will not load in Visual Studio 2012. It won't open the project files with this error...The imported project "C:\IntelliFactory.WebSharper.Sitelets.targets" was not found.


...
let request = inp.ReadLine()
match request with
// Requests to root are redirected to the start page.
| "GET / HTTP/1.0" | "GET / HTTP/1.1" ->
sendHeaders <|
[
"HTTP/1.0 302 Found"
sprintf "Location: http://localhost:%d/iisstart.htm" port
]
| Regex1 "GET /(.*?) HTTP/1\\.[01]$" fileName ->
let fname = Path.Combine(root, fileName)
let mimeType = getMimeType(Path.GetExtension(fname))
if not <| File.Exists(fname) then notFound()
else
let content = File.ReadAllBytes fname
sendHeaders <|
[
"HTTP/1.0 200 OK";
sprintf "Content-Length: %d" content.Length;
sprintf "Content-Type: %s" mimeType
]
stream.Write(content, 0, content.Length)
| _ ->
notFound()