Home Page Icon
Home Page
Table of Contents for
I. Beginnings
Close
I. Beginnings
by Richard Minerich, Talbott Crowell, Aaron C. Erickson, Ted Neward
Professional F# 2.0
Copyright
CREDITS
ABOUT THE AUTHORS
ACKNOWLEDGMENTS
FOREWORD
INTRODUCTION
WHO THIS BOOK IS FOR
WHAT THIS BOOK COVERS
HOW THIS BOOK IS STRUCTURED
WHAT YOU NEED TO USE THIS BOOK
CONVENTIONS
SOURCE CODE
ERRATA
P2P.WROX.COM
I. Beginnings
1. Primer
1.1. SETUP
1.2. IT'S THAT TIME OF YEAR AGAIN...
1.3. STRATEGY
1.4. THE DELEGATE STRATEGY
1.5. LAMBDA CALCULUS (BRIEFLY)
1.6. TYPE INFERENCE
1.7. IMMUTABILITY
1.8. EXPRESSIONS, NOT STATEMENTS
1.9. SUMMARY
II. Basics
2. Lexical Structure
2.1. COMMENTS
2.2. IDENTIFIERS
2.3. PREPROCESSOR DIRECTIVES
2.4. SIGNIFICANT WHITESPACE
2.5. SUMMARY
3. Primitive Types
3.1. BOOLEAN
3.2. NUMERIC TYPES
3.3. BITWISE OPERATIONS
3.4. FLOATING-POINT TYPES
3.5. ARITHMETIC CONVERSIONS
3.6. STRING AND CHARACTER TYPES
3.7. UNIT
3.8. UNITS OF MEASURE TYPES
3.9. LITERAL VALUES
3.10. SUMMARY
4. Control Flow
4.1. BASIC DECISIONS: IF
4.2. LOOPING: WHILE/DO
4.3. LOOPING: FOR
4.4. EXCEPTIONS
4.4.1. try...with
4.4.2. try...finally
4.4.3. Raising and Throwing Exceptions
4.4.4. Defining New Exception Types
4.5. SUMMARY
5. Composite Types
5.1. OPTION TYPES
5.1.1. Option Functions
5.2. TUPLES
5.3. ARRAYS
5.3.1. Array Construction
5.3.2. Array Access
5.3.3. Array Functions
5.3.3.1. Array Meta Functions
5.3.3.2. Array Application Operations
5.4. LISTS
5.4.1. List Construction
5.4.2. List Access
5.4.3. List Methods
5.4.3.1. List Meta Functions
5.4.3.2. List Application Operations
5.5. USING LISTS AND ARRAYS
5.6. SEQUENCES
5.6.1.
5.6.1.1. Seq "Meta" Functions
5.6.1.2. Seq "Application" Operations
5.7. MAPS
5.7.1. Map Construction
5.7.2. Map Access
5.7.3. Map Functions
5.8. SETS
5.9. SUMMARY
6. Pattern Matching
6.1. BASICS
6.2. PATTERN TYPES
6.2.1. Constant Patterns
6.2.2. Variable-Binding ("Named") Patterns
6.2.3. AND, OR Patterns
6.2.4. Literal Patterns
6.2.5. Tuple Patterns
6.2.6. as Patterns
6.2.7. List patterns
6.2.8. Array Patterns
6.2.9. Discriminated Union Patterns
6.2.10. Record Patterns
6.3. PATTERN GUARDS
6.4. ACTIVE PATTERNS
6.4.1. Single Case
6.4.2. Partial Case
6.4.3. Multi-Case
6.5. SUMMARY
III. Objects
7. Complex Composite Types
7.1. TYPE ABBREVIATIONS
7.2. ENUM TYPES
7.3. DISCRIMINATED UNION TYPES
7.4. STRUCTS
7.4.1. Value Type Implicit Members
7.4.2. Structs and Pattern-Matching
7.5. RECORD TYPES
7.5.1. Record Type Implicit Members
7.6. SUMMARY
8. Classes
8.1. BASICS
8.1.1. Fields
8.1.2. Constructors
8.1.3. Creating
8.2. MEMBERS
8.2.1. Properties
8.2.1.1. Named Property Initialization
8.2.1.2. Indexer Properties
8.2.2. Methods
8.2.2.1. Overloaded Methods
8.2.2.2. Named Parameters
8.2.2.3. Optional Parameters
8.3. STATIC MEMBERS
8.3.1. Operator Overloading
8.4. DELEGATES AND EVENTS
8.4.1. Subscribing
8.4.2. Delegates
8.4.3. DelegateEvents
8.4.4. Beyond DelegateEvents: Events
8.5. ACCESS MODIFIERS
8.6. TYPE EXTENSIONS
8.7. SUMMARY
9. Inheritance
9.1. BASICS
9.1.1. Fields and Constructors
9.2. OVERRIDING
9.2.1. Abstract Members
9.2.2. Default
9.3. CASTING
9.3.1. Upcasting
9.3.2. Downcasting
9.3.3. Flexible Types
9.3.4. Boxing and Unboxing
9.3.4.1. Equality, Hashing, and Comparison
9.4. INTERFACES
9.4.1. Implementation
9.4.1.1. Calling Interface Methods
9.4.2. Definition
9.5. OBJECT EXPRESSIONS
9.6. SUMMARY
10. Generics
10.1. BASICS
10.1.1. Type Parameters
10.1.1.1. Member Type Parameters
10.2. TYPE CONSTRAINTS
10.2.1. Type Constraint
10.2.2. Equality Constraint
10.2.3. Comparison Constraint
10.2.4. Null Constraint
10.2.5. Constructor Constraint
10.2.6. Value Type and Reference Type Constraints
10.2.7. Other Constraints
10.3. STATICALLY RESOLVED TYPE PARAMETERS
10.3.1. Explicit Member Constraint
10.4. SUMMARY
11. Packaging
11.1. NAMESPACES
11.1.1. Referencing a Namespace
11.1.2. Defining a Namespace
11.2. MODULES
11.2.1. Referencing a Module
11.2.2. Defining a Module
11.3. SUMMARY
12. Custom Attributes
12.1. USING CUSTOM ATTRIBUTES
12.1.1. EntryPoint
12.1.2. Obsolete
12.1.3. Conditional
12.1.4. ParamArray
12.1.5. Struct, Class, AbstractClass, Interface, Literal, and Measure
12.1.6. Assembly Attributes
12.1.7. DefaultMember
12.1.8. Serializable, NonSerialized
12.1.9. AutoOpen
12.1.10. Other Attributes
12.2. CREATION AND CONSUMPTION
12.2.1. Creation
12.2.2. Consumption
12.3. SUMMARY
IV. Functional Programming
13. Functions
13.1. TRADITIONAL FUNCTION CALLS
13.2. MATHEMATICAL FUNCTIONS
13.3. COMING FROM C#
13.4. FUNCTION ARGUMENTS AND RETURN VALUES
13.4.1. Automatic Generalization and Restriction
13.4.2. The inline Keyword
13.4.3. Type Annotations
13.4.4. Generics and Type Constraints
13.4.5. Statically Resolved Type Parameters
13.5. PARTIAL APPLICATION
13.5.1. Currying
13.5.2. Restrictions on Functions and Methods
13.6. FUNCTIONS AS FIRST CLASS
13.6.1. Recursive Functions
13.6.2. Higher Order Functions
13.6.3. Storing Functions
13.6.4. Creating Functions at Runtime
13.6.4.1. Closures
13.6.4.2. Lambda Expressions
13.6.4.3. Composition with Partial Application
13.7. SUMMARY
14. Immutable Data
14.1. THE PROBLEM WITH STATE
14.2. STATE SAFETY
14.2.1. Programwide State Safety
14.2.2. Local Data State Safety
14.3. DATA MUTATION
14.3.1. Avoiding Mutation
14.3.2. Bubble and Assign
14.3.3. Reference Cells
14.3.4. Passing by Reference
14.3.5. Message Passing
14.4. PERFORMANCE CONSIDERATIONS
14.4.1. Lists
14.4.2. Arrays
14.4.3. Sequences
14.4.4. Tuples
14.4.5. Records
14.4.6. structs
14.5. SUMMARY
15. Data Types
15.1. AMBIGUOUSLY TYPED DATA
15.2. FAILING FAST
15.3. SPECIFICITY
15.3.1. Option as an Example
15.3.2. Encapsulating State in Types
15.3.3. Avoiding Exceptions
15.3.4. Data and State Flow
15.3.5. Recursively Defined Data Types
15.4. SUMMARY
16. List Processing
16.1. COLLECTION ABSTRACTIONS
16.2. MODULE FUNCTIONS
16.3. COLLECTION SUBSETS
16.3.1. filter
16.3.2. partition
16.4. ELEMENT TRANSFORMATIONS
16.4.1. map
16.4.2. choose
16.4.3. collect
16.5. ACCUMULATORS
16.5.1. reduce
16.5.2. fold
16.5.3. scan
16.6. SUMMARY
17. Pipelining and Composition
17.1. BASIC COMPOSITION AND PIPELINING
17.1.1. Pipelining
17.1.1.1. Forward Pipe (|>)
17.1.1.2. Backward Pipe (<|)
17.1.2. Composition
17.1.2.1. Forward Composition (>>)
17.1.2.2. Backward Composition (<<)
17.2. APPLYING PIPELINING AND COMPOSITION
17.2.1. From Loops to Pipelining
17.2.2. From Pipelining to Composition
17.2.3. Advanced Composition
17.3. SUMMARY
V. Applications
18. C#
18.1. OVERVIEW
18.2. CALLING C# LIBRARIES FROM F#
18.2.1. Simple Method Calling Scenarios
18.2.2. C# Object Construction
18.2.3. F#, C#, and null
18.2.4. F# and C# Methods that Expect Delegates
18.2.5. F# and C# Events
18.2.6. F# to C# Summary
18.3. CALLING F# LIBRARIES FROM C#
18.3.1. Basics of Calling F#
18.3.2. F# Tuples in C# Programs
18.3.3. Dealing with F# Records from C#
18.3.4. Passing Functions to F# Functions
18.3.5. Dealing with F# Discriminated Unions from C#
18.3.6. Working with F# Option Types from C#
18.4. RULES OF THUMB FOR WRITING F# APIS
18.5. SUMMARY
19. Databases
19.1. OVERVIEW
19.2. RETRIEVING DATA USING ADO.NET
19.2.1. Creating a Database Connection
19.2.2. Reading Data
19.2.3. Filtering Data
19.2.4. Insert, Update, and Delete
19.3. F# AND OBJECT RELATIONAL MAPPING
19.4. INTRODUCING F# ACTIVE RECORD (FAR)
19.4.1. Reading Data
19.4.2. Querying Data
19.4.3. Adding Data
19.4.4. Updating Data
19.4.5. Deleting Data
19.4.6. What Isn't Supported
19.4.7. Coming Soon
19.5. HOW FAR WORKS
19.5.1. Dependencies
19.5.2. Utility Routines
19.5.3. Table Creation
19.5.4. Query Processing
19.5.4.1. Generating the Parse Tree
19.5.5. Implementation of Other FOR Operations
19.5.5.1. The Use Case for F# Active Record
19.6. SUMMARY
20. XML
20.1. OVERVIEW
20.2. F# AND LINQ-TO-XML
20.2.1. Reading
20.2.2. Querying
20.2.3. Processing
20.2.4. Writing
20.2.5. Writing XML to Memory or Other Stream-Based Resources
20.3. F# AND XML DOM
20.3.1. Reading
20.3.2. Querying
20.3.3. Processing
20.3.4. Writing
20.4. F#, XML, AND ACTIVE PATTERNS
20.4.1. Multi-case Active Patterns
20.4.2. Partial-Case Active Patterns
20.5. SUMMARY
21. ASP.NET MVC
21.1. OVERVIEW
21.2. FORECAST'R — THE WORLD'S SIMPLEST WEATHER FORECAST SITE
21.2.1. Modeling the Domain
21.2.2. Creating a Repository
21.2.2.1. Retrieval of "Where On Earth ID"s
21.2.2.2. From "Where On Earth ID"s to Weather Content
21.2.2.3. Digging Out the Content
21.2.2.4. Returning the Weather Result
21.2.3. Creating the Controller
21.2.3.1. Setting Up the Controller
21.2.3.2. The Index Action
21.2.3.3. The DoQuery Action
21.2.3.4. The For Action
21.2.4. Creating Some View Helpers
21.2.5. Creating the View
21.3. SUMMARY
22. Silverlight
22.1. OVERVIEW
22.1.1. Software Runtime and Developer Requirements
22.2. VISUAL STUDIO PROJECT TEMPLATES
22.2.1. The Silverlight Application
22.2.1.1. Creating the Silverlight Application
22.3. XAP
22.3.1.
22.3.1.1. Testing Silverlight in the Browser
22.4. XAML
22.4.1. The F# Silverlight Library
22.4.1.1. Unit Testing F# Silverlight Library
22.5. THE SILVERLIGHT TOOLKIT
22.5.1. Line Charts and Area Charts
22.5.2. Designer Tools
22.6. DATA BINDING
22.6.1. Design Time Data Binding
22.6.1.1. Adding a Resource to the Application XAML Element
22.6.2. Programmatic Data Binding
22.7. CALCULATING MOVING AVERAGE
22.8. PUTTING IT ALL TOGETHER
22.9. SUMMARY
23. Services
23.1. OVERVIEW
23.2. AN F#-BASED WEATHER SERVICE
23.2.1. The Service Contract
23.3. LEVERAGING THE DOMAIN MODEL
23.4. WRITING THE SERVICE CONTROLLER
23.4.1. Rendering Weather
23.4.2. Helping the Service Controller
23.4.3. Service Controller Implementation
23.4.4. Service Implementation
23.4.5. Implementing the Service Host
23.5. CONSUMING SERVICES
23.5.1. Generating a Service Stub
23.5.2. Writing the Service Consumer
23.6. SUMMARY
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
INTRODUCTION
Next
Next Chapter
1. Primer
Part I. Beginnings
CHAPTER 1
: Primer
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset