Functional Programming in C Classic Programming Techniques for Modern Projects Wrox Programmer to Programmer 1st Edition Oliver Sturm instant download
Functional Programming in C Classic Programming Techniques for Modern Projects Wrox Programmer to Programmer 1st Edition Oliver Sturm instant download
https://ebookfinal.com/download/silverlight-3-programmer-s-reference-
wrox-programmer-to-programmer-1st-edition-j-ambrose-little/
https://ebookfinal.com/download/programming-interviews-exposed-
secrets-to-landing-your-next-job-programmer-to-programmer-2nd-edition-
john-mongan/
https://ebookfinal.com/download/leveraging-drupal-getting-your-site-
done-right-wrox-programmer-to-programmer-1st-edition-victor-kane/
Professional Visual Basic 2010 and NET 4 Wrox Programmer
to Programmer 1st Edition Bill Sheldon
https://ebookfinal.com/download/professional-visual-basic-2010-and-
net-4-wrox-programmer-to-programmer-1st-edition-bill-sheldon/
https://ebookfinal.com/download/visual-studio-2010-and-net-4-six-in-
one-wrox-programmer-to-programmer-1st-edition-istvan-novak/
https://ebookfinal.com/download/beginning-python-programmer-to-
programmer-1st-edition-peter-c-norton/
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Continues
PART IV PUTTING FUNCTIONAL PROGRAMMING INTO ACTION
CHAPTER 18 Integrating Functional Programming Approaches . . . . . . . . . . . . . . . . . 209
CHAPTER 19 The MapReduce Pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
CHAPTER 20 Applied Functional Modularization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
CHAPTER 21 Existing Projects Using Functional Techniques . . . . . . . . . . . . . . . . . . . 247
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
PROFESSIONAL
Functional Programming in C#
CLASSIC PROGRAMMING TECHNIQUES
FOR MODERN PROJECTS
Oliver Sturm
Professional Functional Programming in C#: Classic Programming
Techniques for Modern Projects
Registered offi ce
John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom
For details of our global editorial offi ces, for customer services and for information about how to apply for permission to
reuse the copyright material in this book please see our website at www.wiley.com.
The right of the author to be identified as the author of this work has been asserted in accordance with the Copyright,
Designs and Patents Act 1988.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any
form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK
Copyright, Designs and Patents Act 1988, without the prior permission of the publisher.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.
Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and
product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective
owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed
to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding
that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is
required, the services of a competent professional should be sought.
978-0-470-74458-1
978-0-470-97028-7 (ebk)
978-0-470-97110-9 (ebk)
978-0-470-97109-3 (ebk)
A catalogue record for this book is available from the British Library.
ABOUT THE AUTHOR
OLIVER STURM has over 20 years experience developing professional software. He is a well-known
expert in various areas of application architecture, programming languages and the third party
.NET tools made by DevExpress. His main focus has been on the .NET platform since 2002.
Oliver has spoken at many international conferences and has written more than 20 training classes
and more than 100 magazine articles in English as well as German. He has also taught classes on
topics around computer programming for more than 15 years. For his contributions to the .NET
community, he has been awarded the C# MVP Award by Microsoft United Kingdom for several
years now.
Based in Scotland, UK, Oliver works as a freelance consultant and trainer, and he is an associate at
thinktecture, an international consultancy firm. You can find his blog at www.sturmnet.org/blog and
his commercial website at www.oliversturm.com. His e-mail address is [email protected].
CREDITS
INTRODUCTION xiii
Generic Functions 32
Generic Classes 34
Constraining Types 35
Other Generic Types 37
CONTENTS
Decoupling Parameters 77
Manual Currying 78
Automatic Currying 80
Calling Curried Functions 82
The Class Context 82
What FCSlib Contains 85
Calling Parts of Functions 86
Why Parameter Order Matters 88
Summary 89
viii
CONTENTS
Recursion in C# 117
Tail Recursion 119
Accumulator Passing Style 121
Continuation Passing Style 122
Indirect Recursion 126
Summary 129
CHAPTER 12: STANDARD HIGHER ORDER FUNCTIONS 131
ix
CONTENTS
x
CONTENTS
Refactoring 210
List Filtering with a Windows Forms UI 211
Calculating Mandelbrot Fractals 216
Writing New Code 224
Use Static Methods 224
Prefer Anonymous Methods Over Named Ones 226
Prefer Higher Order Functions over Manual Algorithm
Implementation 227
Prefer Immutable Data 228
Watch Behavior Implementation in Classes 229
Finding Likely Candidates for Functional Programming 229
Shades of Grey 230
Using What’s There 231
Summary 232
CHAPTER 19: THE MAPREDUCE PATTERN 233
xi
CONTENTS
INDEX 261
xii
INTRODUCTION
xiv
INTRODUCTION
may translate even to C# 2.0 in many cases, but the language features that make them reasonably
easy to use are just not available in that version.
I have made several attempts to build the code on the Mono platform, but unfortunately I stumbled
upon compiler bugs every time. Your mileage may vary if you try to use Mono — after all, it
changes all the time.
CONVENTIONS
To help you get the most from the text and keep track of what’s happening, we’ve used a number
of conventions throughout the book.
The pencil icon indicates notes, tips, hints, tricks, and asides to the current
discussion.
SOURCE CODE
As you work through the examples in this book, you may choose either to type in all the code
manually, or to use the source code fi les that accompany the book. All the source code used in this
book is available for download at www.wrox.com. When at the site, simply locate the book’s title
(use the Search box or one of the title lists) and click the Download Code link on the book ’s detail
page to obtain all the source code for the book. Code that is included on the website is highlighted
by the following icon:
Available for
download on
Wrox.com
xv
INTRODUCTION
Listings include the fi lename in the title. If it is just a code snippet, you’ll fi nd the fi lename in a code
note such as this:
Code snippet filename
Because many books have similar titles, you may fi nd it easiest to search by
ISBN; this book’s ISBN is 978 - 0 - 470 -74458 -1.
Once you download the code, just decompress it with your favorite compression tool. Alternately,
you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download
.aspx to see the code available for this book and all other Wrox books.
ERRATA
We make every effort to ensure that there are no errors in the text or in the code. However, no one
is perfect, and mistakes do occur. If you fi nd an error in one of our books, like a spelling mistake
or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may
save another reader hours of frustration, and at the same time, you will be helping us provide even
higher quality information.
To fi nd the errata page for this book, go to www.wrox.com and locate the title using the Search box
or one of the title lists. Then, on the book details page, click the Book Errata link. On this page, you
can view all errata that has been submitted for this book and posted by Wrox editors. A complete
book list, including links to each book ’s errata, is also available at www.wrox.com/misc-pages/
booklist.shtml.
If you don’t spot “your” error on the Book Errata page, go to www.wrox.com/contact/
techsupport.shtml and complete the form there to send us the error you have found. We’ll check
the information and, if appropriate, post a message to the book ’s errata page and fi x the problem in
subsequent editions of the book.
P2P.WROX.COM
For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a Web-based
system for you to post messages relating to Wrox books and related technologies and interact with
other readers and technology users. The forums offer a subscription feature to e -mail you topics
of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other
industry experts, and your fellow readers are present on these forums.
xvi
INTRODUCTION
At p2p.wrox.com, you will fi nd a number of different forums that will help you, not only as you
read this book, but also as you develop your own applications. To join the forums, just follow
these steps:
1. Go to p2p.wrox.com and click the Register link.
2. Read the terms of use and click Agree.
3. Complete the required information to join, as well as any optional information you wish to
provide, and click Submit.
4. You will receive an e-mail with information describing how to verify your account and
complete the joining process.
You can read messages in the forums without joining P2P, but in order to post
your own messages, you must join.
Once you join, you can post new messages and respond to messages other users post. You can read
messages at any time on the Web. If you would like to have new messages from a particular forum
e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.
For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to
questions about how the forum software works, as well as many common questions specific to P2P
and Wrox books. To read the FAQs, click the FAQ link on any P2P page.
xvii
Discovering Diverse Content Through
Random Scribd Documents
The Project Gutenberg eBook of The private
life, The wheel of time, Lord Beaupré, The
visits, Collaboration, Owen Wingrave.
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Title: The private life, The wheel of time, Lord Beaupré, The visits,
Collaboration, Owen Wingrave.
Language: English
OWEN WINGRAVE
BY
HENRY JAMES
LONDON
1893
CONTENTS
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com