Expert F# 3.0, Third Edition

Book 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

    1. Titlepage
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Authors
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Chapter 1: Introduction
      1. The Genesis of F#
      2. About This Book
      3. Who This Book Is For
    9. Chapter 2: Your First F# Program – Getting Started With F#
      1. Creating Your First F# Program
      2. Using Object-Oriented Libraries from F#
      3. Summary
    10. Chapter 3: Introducing Functional Programming
      1. Starting with Numbers and Strings
      2. Working with Conditionals: && and ||
      3. Defining Recursive Functions
      4. Lists
      5. Options
      6. Getting Started with Pattern Matching
      7. Introducing Function Values
      8. Summary
    11. Chapter 4: Introducing Imperative Programming
      1. About Functional and Imperative Programming
      2. Imperative Looping and Iterating
      3. Using Mutable Records
      4. Using Mutable Locals
      5. Working with Arrays
      6. Introducing the Imperative .NET Collections
      7. Exceptions and Controlling Them
      8. Having an Effect: Basic I/O
      9. Combining Functional and Imperative: Efficient Precomputation and Caching
      10. Combining Functional and Imperative: Functional Programming with Side Effects
      11. Summary
    12. Chapter 5: Understanding Types in Functional Programming
      1. Exploring Some Simple Type Definitions
      2. Understanding Generics
      3. Making Things Generic
      4. More on Different Kinds of Types
      5. Understanding Subtyping
      6. Troubleshooting Type-Inference Problems
      7. Summary
    13. Chapter 6: Programming with Objects
      1. Getting Started with Objects and Members
      2. Using Classes
      3. Adding Further Object Notation to Your Types
      4. Defining Object Types with Mutable State
      5. Getting Started with Object Interface Types
      6. More Techniques to Implement Objects
      7. Combining Functional and Objects: Cleaning Up Resources
      8. Extending Existing Types and Modules
      9. Working with F# Objects and .NET Types
      10. Summary
    14. Chapter 7: Encapsulating and Organizing Your Code
      1. Hiding Things
      2. Organizing Code with Namespaces and Modules
      3. Reusing Your Code
      4. Summary
    15. Chapter 8: Working with Textual Data
      1. Building Strings and Formatting Data
      2. Parsing Strings and Textual Data
      3. Using XML as a Concrete Language Format
      4. Some Recursive Descent Parsing
      5. Binary Parsing and Formatting
      6. Summary
    16. Chapter 9: Working with Sequences and Structured Data
      1. Getting Started with Sequences
      2. More on Working with Sequences
      3. Structure Beyond Sequences: Working with Trees
      4. Active Patterns: Views for Structured Data
      5. Equality, Hashing, and Comparison for New Structured Data Types
      6. Tail Calls and Recursive Programming
      7. Summary
    17. Chapter 10: Numeric Programming and Charting
      1. Basic Charting with FSharpChart
      2. Basic Numeric Types and Literals
      3. Sequences, Statistics and Numeric Code
      4. Statistics, Linear Algebra and Distributions with Math.NET
      5. Units of Measure
      6. Summary
    18. Chapter 11: Reactive, Asynchronous, and Parallel Programming
      1. Introducing Some Terminology
      2. Events
      3. Using and Designing Background Workers
      4. Introducing Asynchronous and Parallel Computations
      5. Agents
      6. Observables
      7. Using Shared-Memory Concurrency
      8. Summary
    19. Chapter 12: Symbolic Programming with Structured Data
      1. Verifying Circuits with Propositional Logic
      2. Symbolic Differentiation and Expression Rendering
      3. Summary
    20. Chapter 13: Integrating External Data and Services
      1. Some Basic REST Requests
      2. Getting Started with Type Providers and Queries
      3. More on Queries
      4. More on Relational Databases and ADO.NET
      5. Using WSDL Services
      6. Summary
    21. Chapter 14: Building Smart Web Applications
      1. Serving Web Content the Simple Way
      2. Building Ajax Rich Client Applications
      3. Summary
    22. Chapter 15: Building Mobile Web Applications
      1. Web-based vs. Native Mobile Applications
      2. Feature Detection and Polyfilling in WebSharper
      3. Mobile Capabilities, Touch Events, and Mobile Frameworks
      4. Serving Mobile Content
      5. Building a Mobile Web Application for iOS Devices
      6. Developing Social Networking Applications
      7. WebSharper Mobile
      8. Developing Android Applications with WebSharper
      9. Summary
    23. Chapter 16: Visualization and Graphical User Interfaces
      1. Writing “Hello, World!” in a Click
      2. Understanding the Anatomy of a Graphical Application
      3. Composing User Interfaces
      4. Drawing Applications
      5. Writing Your Own Controls
      6. Displaying Samples from Sensors
      7. Creating a Mandelbrot Viewer
      8. Windows Presentation Foundation
      9. Summary
    24. Chapter 17: Language-Oriented Programming: Advanced Techniques
      1. Computation Expressions
      2. Using F# Reflection
      3. Using F# Quotations
      4. Summary
    25. Chapter 18: Libraries and Interoperating with Other Languages
      1. Types, memory and interoperability
      2. Libraries: A High-Level Overview
      3. Using the System Types
      4. Using Further F# and .NET Data Structures
      5. Supervising and Isolating Execution
      6. Further Libraries for Reflective Techniques
      7. Some Other .NET Types You May Encounter
      8. Under the Hood: Interoperating with C# and other .NET Languages
      9. COM Interoperability
      10. Interoperating with C and C++ with PInvoke
      11. Summary
    26. Chapter 19: Packaging, Debugging and Testing F# Code
      1. Packaging Your Code
      2. Debugging Your Code
      3. Debugging and Testing with F# Interactive
      4. Testing Your Code
      5. Summary
    27. Chapter 20: Designing F# Libraries
      1. Designing Vanilla .NET Libraries
      2. Understanding Functional Design Methodology
      3. Applying the .NET Library Design Guidelines to F#
      4. Some Recommended Coding Idioms
      5. Summary
    28. Index

    Product information

    • Title: Expert F# 3.0, Third Edition
    • Author(s): Don Syme, Adam Granicz, Antonio Cisternino
    • Release date: October 2012
    • Publisher(s): Apress
    • ISBN: 9781430246503