Expert F# 3.0:
Gespeichert in:
Hauptverfasser: | , , |
---|---|
Format: | Buch |
Sprache: | English |
Veröffentlicht: |
Berkeley, Calif.
Apress
2012
|
Ausgabe: | 3. ed. |
Schriftenreihe: | The expert's voice in F#
|
Schlagworte: | |
Online-Zugang: | Inhaltsverzeichnis |
Beschreibung: | XXII, 602 S. |
ISBN: | 9781430246503 |
Internformat
MARC
LEADER | 00000nam a2200000 c 4500 | ||
---|---|---|---|
001 | BV040522399 | ||
003 | DE-604 | ||
005 | 20121123 | ||
007 | t | ||
008 | 121106s2012 |||| 00||| eng d | ||
020 | |a 9781430246503 |9 978-1430246503 | ||
035 | |a (OCoLC)820380500 | ||
035 | |a (DE-599)BVBBV040522399 | ||
040 | |a DE-604 |b ger |e rakwb | ||
041 | 0 | |a eng | |
082 | 0 | |a 004 | |
084 | |a ST 250 |0 (DE-625)143626: |2 rvk | ||
084 | |a DAT 544f |2 stub | ||
084 | |a DAT 360f |2 stub | ||
100 | 1 | |a Syme, Don |e Verfasser |0 (DE-588)1017208190 |4 aut | |
245 | 1 | 0 | |a Expert F# 3.0 |c Don Syme ; Adam Granicz ; Antonio Cisternino |
250 | |a 3. ed. | ||
264 | 1 | |a Berkeley, Calif. |b Apress |c 2012 | |
300 | |a XXII, 602 S. | ||
336 | |b txt |2 rdacontent | ||
337 | |b n |2 rdamedia | ||
338 | |b nc |2 rdacarrier | ||
490 | 0 | |a The expert's voice in F# | |
650 | 0 | 7 | |a F sharp |0 (DE-588)7578680-1 |2 gnd |9 rswk-swf |
689 | 0 | 0 | |a F sharp |0 (DE-588)7578680-1 |D s |
689 | 0 | |5 DE-604 | |
700 | 1 | |a Granicz, Adam |e Verfasser |0 (DE-588)1017209138 |4 aut | |
700 | 1 | |a Cisternino, Antonio |d 1927- |e Verfasser |0 (DE-588)142692573 |4 aut | |
856 | 4 | 2 | |m Digitalisierung UB Bamberg |q application/pdf |u http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=025368671&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |3 Inhaltsverzeichnis |
999 | |a oai:aleph.bib-bvb.de:BVB01-025368671 |
Datensatz im Suchindex
_version_ | 1804149604840636416 |
---|---|
adam_text | Contents
at a Glance
About the Authors
...............................................................................................................xx
About the Technical Reviewer
...........................................................................................xxi
Acknowledgments
.............................................................................................................xxii
Chapter
1:
Introduction
.........................................................................................................1
f§ Chapter
2:
Your First F# Program
-
Getting Started With F#
...............................................7
ti
Chapter
3:
Introducing Functional Programming
...............................................................25
a Chapter
4:
Introducing Imperative Programming
..............................................................49
II
Chapterã:
Understanding Types in Functional Programming
...........................................81
■
Chapter
6:
Programming with Objects
.............................................................................111
Ш
Chapter
7:
Encapsulating and Organizing Your Code
......................................................147
a Chapter
8:
Working with Textual Data
..............................................................................163
Ш
Chapter
9:
Working with Sequences and Structured Data
.............................................189
«
Chapter
10:
Numeric Programming and Charting
............................................................231
ai
Chapter
11:
Reactive, Asynchronous, and Parallel Programming
...................................257
it Chapter
12:
Symbolic Programming with Structured Data
............................................295
Ш
Chapter
13:
Integrating External Data and Services
.......................................................331
m
Chapter
14:
Building Smart Web Applications
.................................................................353
β
Chapter
15:
Building Mobile Web Applications
................................................................391
m
Chapter
16:
Visualization and Graphical User Interfaces
................................................427
Ш
Chapter
17:
Language-Oriented Programming: Advanced Techniques
..........................477
■
Chapter
18:
Libraries and Interoperating with Other Languages
....................................503
§?
Chapter
19:
Packaging, Debugging and Testing F# Code
................................................537
«
Chapter
20:
Designing F# Libraries
..................................................................................565
Index.....
-------.......................................................................................................................¿83
IV
Contents
About the Authors
...............................................................................................................xx
About the Technical Reviewer
...........................................................................................xxi
Acknowledgments
.............................................................................................................xxii
Chapter
1 :
Introduction
.........................................................................................................1
The Genesis of F#
...................................................................................................................2
About This Book
......................................................................................................................2
Who This Book Is For
..............................................................................................................5
Chapter
2:
Your First F# Program
-
Getting Started With F#
...............................................7
Creating Your First F# Program
..............................................................................................7
Documenting Code
........................................................................................................................................9
Using let
..........................................................................................................................................................9
Understanding Types
....................................................................................................................................10
Calling Functions
..........................................................................................................................................11
Lightweight Syntax
......................................................................................................................................11
Understanding Scope
...................................................................................................................................12
Using Data Structures
...................................................................................................................................14
Using Properties and the Dot-Notation
.........................................................................................................14
Using Tuples
.................................................................................................................................................15
Using Imperative Code
..................................................................................................................................17
Using Object-Oriented Libraries from F#
..............................................................................18
Using open to Access Namespaces and Modules
........................................................................................19
Using new and Setting
Propertes
................................................................................................................20
Fetching a Web Page
....................................................................................................................................22
Summary..
............................................................................................................................23
í
CONTENTS
I Chapter
3:
Introducing Functional Programming
....................................................·■■■·......25
Starting with Numbers and Strings
......................................................................................25
Some Simple Types and Literals
...................................................................................................................25
Arithmetic Conversions
.................................................................................................................................26
Arithmetic Comparisons
...............................................................................................................................27
Simple Strings
..............................................................................................................................................27
Working with Conditionals:
&&
and II
...................................................................................28
Defining Recursive Functions
...............................................................................................28
Lists
.....................................................................................................................................30
Options
.................................................................................................................................33
Getting Started with Pattern Matching
.................................................................................34
Matching on Structured Values
.....................................................................................................................35
Guarding Rules and Combining Patterns
....................................................................................·.................36
Further Ways of Forming Patterns
................................................................................................................37
Introducing Function Values
.................................................................................................37
Using Anonymous Function Values
...............................................................................................................39
Computing with Aggregate Operators
..........................................................................................................39
Composing Functions with
».....................................................................................................................41
Building Functions with Partial Application
..................................................................................................42
Using Local Functions.
..................................................................................................................................42
Iterating with Aggregate Operators
..............................................................................................................44
Abstracting Control with Functions
..............................................................................................................44
Using Object Methods as Rrst-Oass Functions
...........................................................................................45
Some Common Uses of Function Values
......................................................................................................45
Summary...........
...................................................................................................................47
■
Chapter
4:
Introducing Imperative Programming
..............................................................49
About Functional and Imperative Programming
...................................................................49
Imperative Looping and Iterating
..........................................................................................50
Simple for Loops
...........................................................................................................................................
so
Simple While Loops
......................................................................................................................................51
More Iteration Loops over Sequences
..........................................................................................................51
Using Mutable Records
..........................................................................
m
.............................52
Mutable Reference
Celte..
................................................................................................... 53
Avoiding Aliasing
..........................................................................................................................................54
Шпд
Mutable Data
...................................,.............,.................,...................................... .........55
I CONTENTS
Using Mutable Locals
...........................................................................................................56
Working with Arrays
.............................................................................................................56
Generating and Slicing Arrays
......................................................................................................................58
Two-Dimensional Arrays
...............................................................................................................................59
Introducing the Imperative .NET Collections
........................................................................59
Using Resizeable Arrays
...............................................................................................................................59
Using Dictionaries
.........................................................................................................................................60
Using Dictionary s TryGetValue
.....................................................................................................................61
Using Dictionaries with Compound Keys
......................................................................................................62
Some Other Mutable Data Structures
...........................................................................................................62
Exceptions and Controlling Them
.........................................................................................63
Catching Exceptions
.....................................................................................................................................64
Using try
...
finally
.......................................................................................................................................65
Defining New Exception Types
......................................................................................................................65
Having an Effect: Basic I/O
...................................................................................................66
.NET I/O via Streams
.....................................................................................................................................67
Some Other I/O-Related Types
......................................................................................................................68
Using System.Console
..................................................................................................................................69
Combining Functional and Imperative: Efficient
Precomputation
and Caching
....................69
Precomputation
and Partial Application
.......................................................................................................69
Precomputation
and Objects
........................................................................................................................70
Memoizing Computations
.............................................................................................................................71
Lazy Values
...................................................................................................................................................74
Other Variations on Caching and Memoization
.............................................................................................75
Combining Functional and Imperative: Functional Programming with Side Effects
.............75
Consider Replacing Mutable Locals and Loops with Recursion
...................................................................76
Separating Pure Computation from Side-Effecting Computations
...............................................................76
Separating Mutable Data Structures
............................................................................................................76
Not All Side Effects Are Equal
.......................................................................................................................77
Avoid Combining Imperative Programming and Laziness
............................................................................78
Summary
..............................................................................................................................79
!
Chapters: Understanding Types in Functional Programming
...........................................81
Exploring Some Simple Type Definitions
.....,........................................................................81
Defining Type Abbreviations
.........................................................................................................................81
Defining Record Types
..................................................................................................................................82
Handling Non-Unique Record FSeW
Mames
..................................................................................................83
m
CONTENTS
Cloning Records
............................................................................................................................................84
Defining Discriminated Unions
.....................................................................................................................84
Using Discriminated Unions as Records
.......................................................................................................86
Defining Multiple Types Simultaneously
.......................................................................................................87
Understanding Generics
.......................................................................................................87
Writing Generic Functions
............................................................................................................................88
Some Important Generic Functions
..............................................................................................................89
Making Things Generic
.........................................................................................................94
Generic Algorithms through Explicit Arguments
...........................................................................................94
Generic Algorithms through Function Parameters
........................................................................................95
Generic Algorithms through Inlining
............................................................................................................97
More on Different Kinds of Types
..........................................................................................99
Reference Types and Value Types
.................................................................................................................99
Other Flavors of .NET Types
........................................................................................................................100
Understanding Subtyping
...................................................................................................100
Casting Up Statically
...................................................................................................................................101
Casting Down Dynamically
.........................................................................................................................101
Performing Type Tests via Pattern Matching
..............................................................................................102
Knowing When Upcasts Are Applied Automatically
....................................................................................102
Flexible Types
.............................................................................................................................................104
Troubleshooting Type-Inference Problems
.........................................................................104
Using
a Visual
Editing Environment
............................................................................................................105
Using Type Annotations
...............................................................................................................................105
Understanding the value Restriction
..........................................................................................................106
Working Around
tne
Value Restriction
........................................................................................................107
Understanding Generic Overloaded Operators
...........................................................................................109
Summary
............................................................................................................................109
і
Chapter
6:
Programming with Objects
.............................................................................111
Getting Started with Objects and Members
.......................................................................111
Using Classes
.....................................................................................................................114
Adding Further Object Notation to Your Types
....................................................................117
Working with
indexer
Properties
................................................................................................................118
Adding Overloaded Operators
.....................................................................................................................118
Using Named and Optional Arguments
.......................................................................................................120
Adding Method Overloading
.........................................................................,.............................................121
Defining Object Types with Mutable State
........................................................ ...............
Ш
Vttt
і
CONTENTS
Using Optional Property Settings
................................................................................................................124
Declaring Auto-Properties
..........................................................................................................................125
Getting Started with Object Interface Types
.......................................................................126
Defining New Object Interface Types
..........................................................................................................127
Implementing Object Interface Types Using Object Expressions
................................................................127
Implementing Object Interface Types Using Concrete Types
......................................................................129
Using Common Object Interface Types from the .NET Libraries
.................................................................129
Understanding Hierarchies of Object Interface Types
.................................................................................130
More Techniques to Implement Objects
.............................................................................131
Combining Object Expressions and Function Parameters
..........................................................................131
Defining Partially Implemented Class Types
...............................................................................................133
Using Partially Implemented Types via Delegation
.....................................................................................133
Using Partially Implemented Types via Implementation Inheritance
..........................................................134
Combining Functional and Objects: Cleaning Up Resources
..............................................135
Resources and IDisposable
.......................................................................................................................136
Managing Resources with More Complex Lifetimes
..................................................................................138
Cleaning Up Internal Objects
......................................................................................................................139
Cleaning Up Unmanaged Objects
...............................................................................................................140
Extending Existing Types and Modules
...............................................................................141
Working with F# Objects and .NETTypes
...........................................................................143
Structs
........................................................................................................................................................144
Delegates
....................................................................................................................................................144
Enums
.........................................................................................................................................................145
Working with null Values
............................................................................................................................145
Summary
............................................................................................................................146
¡
Chapter
7:
Encapsulating and Organizing Your Code
...........................................—.....147
Hiding Things
.....................................................................................................................147
Hiding Things with Local Definitions
..........................................................................................................148
Hiding Things with Accessibility Annotations
.............................................................................................150
Organizing Code with Namespaces and Modules
..............................................................152
Puffing Your Code in a Module
.....„.............................................................................................................153
Putting Your Modules and Types in Namespaces
.......................................................................................153
Hiding Things with Signatures
...........................................................................................................--------154
Designing with Signatures
..........................................................................................................-------.......156
When Are Signature Types Checked?
...................-------..............................„----------------------..--------..-------156
Defining a Module wim №e Same Name as a Type
..................._______.____........-------------------------...„156
:, CONTENTS
Preventing Client Code from Opening a Module
........................................................................................156
Using Files as Modules
...............................................................................................................................157
Automatically Opening Modules
.................................................................................................................158
Reusing Your Code
..............................................................................................................158
Using Files as Small Reusable Components
..............................................................................................159
Creating Assemblies, DLLs, and EXEs
.........................................................................................................159
Creating and Sharing Packages
.................................................................................................................161
Summary
............................................................................................................................162
í
Chapter
8:
Working with Textual Data
.............................................................■.....·..........163
Building Strings and Formatting Data
................................................................................163
Building Strings
..........................................................................................................................................163
More about String Literals
..........................................................................................................................164
Using printf and Friends
.............................................................................................................................165
Generic Structural Formatting
....................................................................................................................167
Formatting Strings Using .NET Formatting
.................................................................................................167
Parsing Strings and Textual Data
........................................................................................168
Parsing Basic Values
..................................................................................................................................168
Processing Line-Based Input
.................................,....................................................................................169
Using Regular Expressions to Parse Lines
.................................................................................................170
More on Matching with System.Text.RegularExpressions
..........................................................................171
Encoding and Decoding Unicode Strings
....................................................................................................175
Encoding and Decoding Binary Data
..........................................................................................................176
Using XML as a Concrete Language Format
......................................................................176
Using the System.Xml Namespace
.............................................................................................................176
From Concrete XML to Abstract Syntax
......................................................................................................178
Some Recursive Descent Parsing
.......................................................................................180
A Simple Tokenizer
.....................................................................................................................................181
Recursive-Descent Parsing
........................................................................................................................181
Binary Parsing and Formatting
..........................................................................................183
Summary
............................................................................................................................187
•
Chapter
9:
Working with Sequences and Structured Data
.............................................189
Getting Started with Sequences
..............................................,..........................................189
Using Range Expressions
...........................................................................................................................190
Iterating a Sequence
.................................................................................................................................191
Transforming Sequences with Aggregate Operators
..................................................................................191
Which Types Can Be Used as Sequences?
.................................................................................................192
« CONTENTS
Using Lazy Sequences from External Sources
...........................................................................................192
Using Sequence Expressions
......................................................................................................................193
Enriching Sequence Expressions with Additional Logic
.............................................................................194
Generating Lists and Arrays Using Sequence Expressions
........................................................................195
More on Working with Sequences
......................................................................................196
Using Other Sequence Operators: Truncate and Sort
.................................................................................197
Selecting Multiple Elements From Sequences
...........................................................................................198
Finding Elements and Indexes in Sequences
.............................................................................................199
Grouping and Indexing Sequences
.............................................................................................................200
Folding Sequences
.....................................................................................................................................201
Cleaning Up in Sequence Expressions
.......................................................................................................202
Expressing Some Operations Using Sequence Expressions
.......................................................................203
Structure Beyond Sequences: Working with Trees
............................................................203
Example: Abstract Syntax Representations
................................................................................................204
Transforming Abstract Syntax Representations
..........................................................................................205
Using On-Demand Computation with Abstract Syntax Trees
......................................................................206
Caching Properties in Abstract Syntax Trees
..............................................................................................208
Memoizing
Construction
of Syntax Tree Nodes
..........................................................................................208
Active Patterns: Views for Structured Data
........................................................................210
Converting the Same Data to Many Views
..................................................................................................211
Matching on .NET Object Types
..................................................................................................................213
Defining Partial and Parameterized Active Patterns
...................................................................................214
Hiding Abstract Syntax Implementations with Active Patterns
...................................................................214
Equality, Hashing, and Comparison for New Structured Data Types
...................................216
Equality, Hashing, and Comparison
.............................................................................................................216
Asserting Equality, Hashing, and Comparison Using Attributes
..................................................................218
Fully Customizing Equality, Hashing, and Comparison on a Type
...............................................................219
Suppressing Equality, Hashing, and Comparison on a Type
.......................................................................220
Customizing Generic Collection Types
........................................................................................................221
Tail Calls and Recursive Programming
..............................................................................222
Tail Recursion and list Processing
.............................................................................................................223
Tail Recursion and Object-Oriented Programming
.....................................................................................225
Tail Recursion and Processing Unbalanced Trees
......................................................................................226
Using Continuations to Avoid Stack Overflows
...........................................................................................227
Another Example: Processing Syntax Trees
................................................................................................228
Summary
............................................................................................................................230
m
і
CONTENTS
Chapter
10:
Numeric Programming and Charting
............................................................231
Basic Charting with FSharpChart
.......................................................................................231
Basic Numeric Types and Literals
......................................................................................233
Arithmetic Operators
..................................................................................................................................234
Checked Arithmetic
....................................................................................................................................234
Arithmetic Conversions
...............................................................................................................................235
Arithmetic Comparisons
.............................................................................................................................235
Overloaded Math Functions
........................................................................................................................236
Bitwise Operations
.....................................................................................................................................236
Sequences, Statistics and Numeric Code
..........................................................................237
Summing, Averaging, Maximizing and Minimizing Sequences
...................................................................237
Counting and Categorizing
.........................................................................................................................239
Writing Fresh Numeric Code
.......................................................................................................................240
Making Numeric Code Generic
..................................................................................................................241
Example: KMeans
.......................................................................................................................................242
Statistics, Linear Algebra and Distributions with Math.NET
...............................................244
Bask: Statistical Functions in Math.NET Numerics
.....................................................................................245
Using Histograms and Distributions from Math.NET Numerics
..................................................................246
Using Matrices and Vectors from Math.NET
..............................................................................................248
Matrix Inverses, Decompositions and Eigenvalues
.....................................................................................249
Units of Measure
................................................................................................................250
Adding Units to a Numeric Algorithms
........................................................................................................251
Adding Units to a Type Definition
................................................................................................................253
Applying and Removing Units
.....................................................................................................................254
Some Limitations of Units of Measure
........................................................................................................254
Summary
............................................................................................................................255
і
Chapter
11:
Reactive, Asynchronous, and Parallel Programming
...................................257
Introducing Some Terminology
...........................................................................................258
Events
.................................................................................................................................259
Events as First-Class Values
.......................................................................................................................260
Creating and Publishing Events
..................................................................................................................260
Using and Designing Background Workers
........................................................................262
Building a Simpler Iterative Worker
............................................................................................................264
Raising Additional Events from Background Workers
.................................................................................267
Connecting a Background Worker to a GUI.
................................................................................................268
Xtl
í
CONTENTS
Introducing Asynchronous and Parallel Computations
.......................................................270
Fetching Multiple Web Pages in Parallel, Asynchronously
..........................................................................270
Understanding Thread Hopping
..................................................................................................................272
Under the Hood: What Are Asynchronous Computations?
..........................................................................273
Parallel File Processing Using Asynchronous Workflows
...........................................................................275
Running Asynchronous Computations
........................................................................................................278
Common I/O Operations in Asynchronous Workflows
.................................................................................279
Using Tasks with Asynchronous Programming
...........................................................................................280
Understanding Exceptions and Cancellation
..............................................................................................280
Under the Hood: Implementing AsyncParallel
............................................................................................281
Using async for CPU Parallelism with Fixed Tasks
.....................................................................................282
Agents
................................................................................................................................282
Introducing Agents
......................................................................................................................................283
Creating Objects That React to Messages
..................................................................................................284
Scanning Mailboxes for Relevant Messages
..............................................................................................286
Example: Asynchronous Web Crawling
.......................................................................................................287
Observables
........................................................................................................................290
Using Shared-Memory Concurrency
..................................................................................290
Creating Threads Explicitly
.........................................................................................................................291
Shared Memory, Race Conditions, and the .NET Memory Model
................................................................291
Using Locks to Avoid Race Conditions
........................................................................................................292
Using ReaderWriteitock
.............................................................................................................................293
Some Other Concurrency Primitives
...........................................................................................................294
Summary
............................................................................................................................294
>
Chapter
12:
Symbolic Programming with Structured
Dabi
............................................295
Verifying Circuits with Propositional Logic
.........................................................................295
Representing Prepositional Logic
...............................................................................................................296
Evaluating Propositional Logic Naively
.......................................................................................................298
From Circuits to Propositional Logic
...........................................................................................................300
Checking Simple Properties of Circuits
...........................................................,..........................................303
Representing Propositional Formulae Efficiently Using BDOs
....................................................................303
Circuit Verification with BODs
.....................................................................................................................307
Symbolic Differentiation and Expression Rendering
..........................................................309
Modeling Simple Algebraic Expressions
..............................................................................—.........--------310
Implementing Local Simplifications
.....................................................................................------------........312
A Richer Language of Algebraic Expressions
......................................................--------------.—................313
X1U
m
CONTENTS
Parsing Algebraic Expressions
.................................................................................................................»315
Simplifying Algebraic Expressions
..............................................................................................................317
Symbolic Differentiation of Algebraic Expressions
.....................................................................................319
Rendering Expressions
...............................................................................................................................320
Building the User Interface
.........................................................................................................................327
Summary
............................................................................................................................329
і
Chapter
13:
Integrating External Data and Services
.......................................................331
Some Basic REST Requests
...............................................................................................332
Getting Data in JSON Format
......................................................................................................................333
Parsing the XML or JSON Data
..................................................................................................................333
Handling Multiple Pages
.............................................................................................................................334
Getting Started with Type Providers and Queries
...............................................................335
Example
-
Language Integrated OData
.......................................................................................................335
What is a Type Provider?
............................................................................................................................336
What is a Query?
........................................................................................................................................337
Handling Pagination in OData
.....................................................................................................................339
Example
-
Language Integrated SQL
..........................................................................................................340
More on Queries
.................................................................................................................341
Sorting
........................................................................................................................................................342
Aggregation
................................................................................................................................................342
Nullables
.....................................................................................................................................................343
Inner Queries
..............................................................................................................................................343
Grouping
.....................................................................................................................................................344
Joins
...........................................................................................................................................................344
More on Relational Databases and ADO.NET
......................................................................345
Establishing Connections using AD0.NET
...................................................................................................347
Creating
a
Datebase
using ADO.NET
...........................................................................................................348
Creating Tables using AD0.NET
...................................................................................................................348
Using Stored Procedures via AD0.NET
........................................................................................................350
Using WSDL Services
................................................................,........................................351
Summary
............................................................................................................................352
•
Chapter
14:
Building Smart Web Applications
.................................................................353
Serving Web Content the Simple Way
.........................„.....................................................353
Building Ajax
Rich Client Applications
................................................................................358
Learning More from the WebSharper Documentation
................................................................................35g
Getting Started wiftWebSharper
.............................................................................. 360
β
CONTENTS
Calling Server Code from the Client
...........................................................................................................362
WebSharperSitelets
...................................................................................................................................363
Online vs. Offline Sitelets
............................................................................................................................364
Serving Content from WebSharper Sitelets
................................................................................................365
Using Dynamic Templates
...........................................................................................................................367
Embedding Client-Side Controls in Sitelet Pages
.......................................................................................368
Constructing and Combining Sitelets
.........................................................................................................369
Sitelet Routers and Controllers
...................................................................................................................372
Constructing Sitelets for Handling Non-GET HTTP Commands
...................................................................372
WebSharper Formlets
.................................................................................................................................379
Dependent Formlets and Flowlets
..............................................................................................................387
Automated Resource Tracking and Handling
..............................................................................................387
Using Third-Party JavaScript Libraries
.......................................................................................................388
Working with .NET Proxies
.........................................................................................................................389
Summary
............................................................................................................................390
Chapter
15:
Building Mobile Web Applications
................................................................391
Web-based vs. Native Mobile Applications
........................................................................391
Feature Detection and Polyfilling in WebSharper
...............................................................393
Mobile Capabilities, Touch
Evente,
and Mobile Frameworks
..............................................395
Serving Mobile Content
.....................................................................................................397
Building a Mobile Web Application for ¡OS Devices
............................................................398
Fleshing Out the Application
.......................................................................................................................399
Digging Deeper
...........................................................................................................................................404
Developing Social Networking Applications
.......................................................................406
Configuring Your New Facebook Application
..............................................................................................409
Defining the Main HTML Application
...........................................................................................................410
WebSharper Mobile
............................................................................................................415
Developing Android Applications with WebSharper
............................................................417
Setting Up and Testing with Your Android Environment
..............................................................................418
Using the Android Application Visual Studio Template
................................................................................420
Implementing Your Native Android
Application
...........................................................................................421
Summary
............................................................................................................................426
і
Chapter
16:
Visualization and Graphical User Interfaces
...........................--------------...427
Writing Hello, World! in a Click........
................................................................................427
Understanding the Anatomy of a Graphical Application
.....................................................428
í
CONTENTS
Composing User Interfaces
................................................................................................429
Drawing Applications
..........................................................................................................433
Writing Your Own Controls
..................................................................................................438
Developing a Custom Control
.....................................................................................................................438
Anatomy of a Control
..................................................................................................................................441
Displaying Samples from Sensors
......................................................................................441
Building the GraphControl: The Model
........................................................................................................443
Building the GraphControl: Style Properties and Controller
........................................................................445
Building the GraphControl: The View
..........................................................................................................449
Puffing It Together
......................................................................................................................................453
Creating a Mandelbrot Viewer
............................................................................................454
Computing Mandelbrot
...............................................................................................................................454
Setting Colors
.............................................................................................................................................455
Creating the Visualization Application
........................................................................................................457
Creating the Application Plumbing
.............................................................................................................460
Windows Presentation Foundation
.....................................................................................465
When GUIs Meet the Web
...........................................................................................................................466
Drawing
......................................................................................................................................................468
Controls
......................................................................................................................................................471
Bitmaps and Images
...................................................................................................................................474
Final Considerations.
..................................................................................................................................476
Summary
............................................................................................................................476
■
Chapter
17:
Language-Oriented Programming: Advanced Techniques
..........................477
Computation Expressions
...................................................................................................478
An Example: Success/Failure Workflows
....................................................................................................480
Defining a Workflow Builder
.......................................................................................................................483
Workflows and Untamed Side Effects
........................................................................................................485
Compilation Expressions with Custom Query Operators
...........................................................................486
Example: Probabilistic Workflows
...............................................................................................................487
Combining Workflows ami Resources
........................................................................................................492
Recursive Workflow Expressions
................................................................................................................492
Using F# Reflection
............................................................................................................492
Reflecting on Types
...............................................................................................................................493
Schema Compilation by Reflecting on Types
...........................................................................................,„493
Using the F# Dynamic Reflection Operators
.........«................................................................ .497
Using F# Quotations
..........................................................
ZľZľZľZľZZZZZZZi»
XVI
ì
CONTENTS
Example: Using F# Quotations for Error Estimation
....................................................................................499
Resolving Reflected Definitions
..................................................................................................................501
Summary
............................................................................................................................501
Chapter
18:
Libraries and Interoperatjng with Other Languages
....................................503
Types, memory and interoperability
...................................................................................503
Libraries: A High-Level Overview
........................................................................................504
Namespaces from the .NET Framework
.....................................................................................................505
Namespaces from the F# Libraries
.............................................................................................................507
Using the System Types
.....................................................................................................508
Using Further F# and .NET Data Structures
........................................................................508
System-Collections-Generic and Other .NET Collections
............................................................................509
Supervising and Isolating Execution
..................................................................................509
Further Libraries for Reflective Techniques
........................................................................510
Using General Types
...................................................................................................................................510
Using Microsoft.FSharp.Reflection
.............................................................................................................511
Some Other .NET Types You May Encounter
.......................................................................511
Under the Hood: Interoperatjng with C# and other .NET Languages
..................................512
The Common Language Runtime
...............................................................................................................512
Memory Management at Runtime
..............................................................................................................514
COM Interoperability
...........................................................................................................516
Calling COM Components from F#
..............................................................................................................516
The Running Object Table
...........................................................................................................................521
Interoperating with
С
and
C++
with Plnvoke
.....................................................................522
Getting Started with Plnvoke
......................................................................................................................523
Mapping
С
Data Structures to F# Code
......................................................................................................525
Marshalling Parameters to and from
С
.......................................................................................................526
Marshalling Strings to and from
С
.............................................................................................................528
Passing Function Pointers to
С
...................................................................................................................530
Plnvoke Memory Mapping
..........................................................................................................................531
Wrapper Generation and Limits of Plnvoke
................................................................................................534
Summary
............................................................................................................................535
і
Chapter
19:
Packaging, Debugging and Testing F# Code
.......................—...........—....537
Packaging Your Code
.........................................................................................................537
Mixing Scripting and Compiled Code
................................................,.........................................................537
Choosing Optimization Settings
..................................................................................................................538
XVII
S CONTENTS
Generating Documentation
.........................................................................................................................539
Building
Shared Libraries..........................................................................................................................
539
Using Static Unking
....................................................................................................................................541
Packaging Different Kinds of Code
.............................................................................................................541
Using Data and Configuration Settings
.......................................................................................................542
Debugging Your Code
.........................................................................................................543
Using More Features of the Visual Studio Debugger
..................................................................................546
Instrumenting Your Program with the
System.Diagnostics Namespace
................................................................................................................
54£
Debugging Concurrent and Graphical Applications
....................................................................................551
Debugging and Testing with F# Interactive
........................................................................553
Controlling F# Interactive
...........................................................................................................................552
Some Common F# Interactive Directives
....................................................................................................554
Understanding How F# Interactive Compiles Code
.....................................................................................
55£
F# Interactive and Visual Studio
.................................................................................................................
55C
Testing Your Code
...............................................................................................................557
Summary
............................................................................................................................563
1
Chapter
20:
Designing F# Libraries
..................................................................................
56S
Designing Vanilla .NET Libraries
.........................................................................................566
Understanding Functional Design Methodology
.................................................................571
Understanding Where Functional Programming Comes From
....................................................................571
Understanding Functional Design Methodology
.........................................................................................572
Applying the .NET Library Design Guidelines to F#
............................................................574
Recommendation: Use the .NET Naming and Capitalization Conventions Where Possible
.......................574
Recommendation: Avoid Using Underscores in Names
.............................................................................576
Recommendation: Follow the .NET Guidelines for Exceptions
...................................................................577
Recommendation: Consider Using Option Values for Return Types Instead of Raising Exceptions
............577
Recommendation: Follow the .NET Guidelines for Value Types
..................................................................577
Recommendation: Consider Using Explicit Signature Files for Your Framework
........................................578
Recommendation: Consider Avoiding the Use of Implementation Inheritance for Extensibility
.................578
Recommendation: Use Properties and Methods for Attributes and Operations Essential to a Type
..........578
Recommendation: Avoid Revealing Concrete Data Representations Such as Records
.............................579
Recommendation: Use Active Patterns to Hide the Implementations of Discriminated Unions
..................579
Recommendation: Use Object Interface Types Instead of Tuples or Records of Functions
.........................579
Recommendation: Understand When Currying Is Useful in Functional Programming APIs
........................579
Recommentíation:
Use Tuptes for Return Values, Arguments, and Intermediate Values
............................580
XVIII
CONTENTS
Some Recommended Coding Idioms
..................................................................................580
Recommendation: Use the Standard Operators
..........................................................................................581
Recommendation: Place the Pipeline Operator |
>
at the Start of a Line
....................................................581
Recommendation: Format Object Expressions Using the member Syntax
.................................................581
Summary
............................................................................................................................582
Index
......................................................................................................................................583
XIX
|
any_adam_object | 1 |
author | Syme, Don Granicz, Adam Cisternino, Antonio 1927- |
author_GND | (DE-588)1017208190 (DE-588)1017209138 (DE-588)142692573 |
author_facet | Syme, Don Granicz, Adam Cisternino, Antonio 1927- |
author_role | aut aut aut |
author_sort | Syme, Don |
author_variant | d s ds a g ag a c ac |
building | Verbundindex |
bvnumber | BV040522399 |
classification_rvk | ST 250 |
classification_tum | DAT 544f DAT 360f |
ctrlnum | (OCoLC)820380500 (DE-599)BVBBV040522399 |
dewey-full | 004 |
dewey-hundreds | 000 - Computer science, information, general works |
dewey-ones | 004 - Computer science |
dewey-raw | 004 |
dewey-search | 004 |
dewey-sort | 14 |
dewey-tens | 000 - Computer science, information, general works |
discipline | Informatik |
edition | 3. ed. |
format | Book |
fullrecord | <?xml version="1.0" encoding="UTF-8"?><collection xmlns="http://www.loc.gov/MARC21/slim"><record><leader>01415nam a2200385 c 4500</leader><controlfield tag="001">BV040522399</controlfield><controlfield tag="003">DE-604</controlfield><controlfield tag="005">20121123 </controlfield><controlfield tag="007">t</controlfield><controlfield tag="008">121106s2012 |||| 00||| eng d</controlfield><datafield tag="020" ind1=" " ind2=" "><subfield code="a">9781430246503</subfield><subfield code="9">978-1430246503</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(OCoLC)820380500</subfield></datafield><datafield tag="035" ind1=" " ind2=" "><subfield code="a">(DE-599)BVBBV040522399</subfield></datafield><datafield tag="040" ind1=" " ind2=" "><subfield code="a">DE-604</subfield><subfield code="b">ger</subfield><subfield code="e">rakwb</subfield></datafield><datafield tag="041" ind1="0" ind2=" "><subfield code="a">eng</subfield></datafield><datafield tag="082" ind1="0" ind2=" "><subfield code="a">004</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">ST 250</subfield><subfield code="0">(DE-625)143626:</subfield><subfield code="2">rvk</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 544f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="084" ind1=" " ind2=" "><subfield code="a">DAT 360f</subfield><subfield code="2">stub</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Syme, Don</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)1017208190</subfield><subfield code="4">aut</subfield></datafield><datafield tag="245" ind1="1" ind2="0"><subfield code="a">Expert F# 3.0</subfield><subfield code="c">Don Syme ; Adam Granicz ; Antonio Cisternino</subfield></datafield><datafield tag="250" ind1=" " ind2=" "><subfield code="a">3. ed.</subfield></datafield><datafield tag="264" ind1=" " ind2="1"><subfield code="a">Berkeley, Calif.</subfield><subfield code="b">Apress</subfield><subfield code="c">2012</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">XXII, 602 S.</subfield></datafield><datafield tag="336" ind1=" " ind2=" "><subfield code="b">txt</subfield><subfield code="2">rdacontent</subfield></datafield><datafield tag="337" ind1=" " ind2=" "><subfield code="b">n</subfield><subfield code="2">rdamedia</subfield></datafield><datafield tag="338" ind1=" " ind2=" "><subfield code="b">nc</subfield><subfield code="2">rdacarrier</subfield></datafield><datafield tag="490" ind1="0" ind2=" "><subfield code="a">The expert's voice in F#</subfield></datafield><datafield tag="650" ind1="0" ind2="7"><subfield code="a">F sharp</subfield><subfield code="0">(DE-588)7578680-1</subfield><subfield code="2">gnd</subfield><subfield code="9">rswk-swf</subfield></datafield><datafield tag="689" ind1="0" ind2="0"><subfield code="a">F sharp</subfield><subfield code="0">(DE-588)7578680-1</subfield><subfield code="D">s</subfield></datafield><datafield tag="689" ind1="0" ind2=" "><subfield code="5">DE-604</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Granicz, Adam</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)1017209138</subfield><subfield code="4">aut</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Cisternino, Antonio</subfield><subfield code="d">1927-</subfield><subfield code="e">Verfasser</subfield><subfield code="0">(DE-588)142692573</subfield><subfield code="4">aut</subfield></datafield><datafield tag="856" ind1="4" ind2="2"><subfield code="m">Digitalisierung UB Bamberg</subfield><subfield code="q">application/pdf</subfield><subfield code="u">http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=025368671&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA</subfield><subfield code="3">Inhaltsverzeichnis</subfield></datafield><datafield tag="999" ind1=" " ind2=" "><subfield code="a">oai:aleph.bib-bvb.de:BVB01-025368671</subfield></datafield></record></collection> |
id | DE-604.BV040522399 |
illustrated | Not Illustrated |
indexdate | 2024-07-10T00:25:41Z |
institution | BVB |
isbn | 9781430246503 |
language | English |
oai_aleph_id | oai:aleph.bib-bvb.de:BVB01-025368671 |
oclc_num | 820380500 |
open_access_boolean | |
physical | XXII, 602 S. |
publishDate | 2012 |
publishDateSearch | 2012 |
publishDateSort | 2012 |
publisher | Apress |
record_format | marc |
series2 | The expert's voice in F# |
spelling | Syme, Don Verfasser (DE-588)1017208190 aut Expert F# 3.0 Don Syme ; Adam Granicz ; Antonio Cisternino 3. ed. Berkeley, Calif. Apress 2012 XXII, 602 S. txt rdacontent n rdamedia nc rdacarrier The expert's voice in F# F sharp (DE-588)7578680-1 gnd rswk-swf F sharp (DE-588)7578680-1 s DE-604 Granicz, Adam Verfasser (DE-588)1017209138 aut Cisternino, Antonio 1927- Verfasser (DE-588)142692573 aut Digitalisierung UB Bamberg application/pdf http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=025368671&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA Inhaltsverzeichnis |
spellingShingle | Syme, Don Granicz, Adam Cisternino, Antonio 1927- Expert F# 3.0 F sharp (DE-588)7578680-1 gnd |
subject_GND | (DE-588)7578680-1 |
title | Expert F# 3.0 |
title_auth | Expert F# 3.0 |
title_exact_search | Expert F# 3.0 |
title_full | Expert F# 3.0 Don Syme ; Adam Granicz ; Antonio Cisternino |
title_fullStr | Expert F# 3.0 Don Syme ; Adam Granicz ; Antonio Cisternino |
title_full_unstemmed | Expert F# 3.0 Don Syme ; Adam Granicz ; Antonio Cisternino |
title_short | Expert F# 3.0 |
title_sort | expert f 3 0 |
topic | F sharp (DE-588)7578680-1 gnd |
topic_facet | F sharp |
url | http://bvbr.bib-bvb.de:8991/F?func=service&doc_library=BVB01&local_base=BVB01&doc_number=025368671&sequence=000002&line_number=0001&func_code=DB_RECORDS&service_type=MEDIA |
work_keys_str_mv | AT symedon expertf30 AT graniczadam expertf30 AT cisterninoantonio expertf30 |