Programming F# 3.0, 2nd Edition.pdf

(15817 KB) Pobierz
Programming F# 3.0
Chris Smith
Programming F# 3.0
by Chris Smith
Copyright © 2013 Chris Smith. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Rachel Roumeliotis
Production Editor:
Holly Bauer
Copyeditor:
Jasmine Kwityn
Proofreader:
Absolute Service, Inc.
Indexer:
Lucie Haskins
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Rebecca Demarest
October 2009:
October 2012:
First Edition
Second Edition
Revision History for the Second Edition:
2012-10-08
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449320294
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
Programming F# 3.0,
the image of a bullfinch, and related trade dress are trademarks of O’Reilly
Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade­
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-32029-4
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Part I. Multiparadigm Programming
1. Introduction to F#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Getting to Know F#
Visual Studio 11
Your Second F# Program
Values
Whitespace Matters
.NET Interop
Comments
F# Interactive
Managing F# Source Files
Primitive Types
Numeric Primitives
Arithmetic
Conversion Routines
BigInteger
Bitwise Operations
Characters
Strings
Boolean Values
Comparison and Equality
Functions
Type Inference
Generic Functions
3
4
5
6
6
8
8
9
11
15
16
17
19
19
20
20
21
22
24
24
25
27
2. Fundamentals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
iii
Zgłoś jeśli naruszono regulamin