Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning D

You're reading from   Learning D Leverage the modern convenience and modelling power of the D programming language to develop software with native efficiency

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781783552481
Length 464 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Michael Parker Michael Parker
Author Profile Icon Michael Parker
Michael Parker
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. How to Get a D in Programming 2. Building a Foundation with D Fundamentals FREE CHAPTER 3. Programming Objects the D Way 4. Running Code at Compile Time 5. Generic Programming Made Easy 6. Understanding Ranges 7. Composing Functional Pipelines with Algorithms and Ranges 8. Exploring the Wide World of D 9. Connecting D with C 10. Taking D Online 11. Taking D to the Next Level Index

Chapter 7. Composing Functional Pipelines with Algorithms and Ranges

A frequent source of difficulty for new D users with no background in functional programming is that making sense of the range-based functions from Phobos can be rather daunting, particularly when looking at a long chain of function calls with names that seem as if they come from an alien language. As an old C programmer myself, I still think of hash maps when I see std.algorithm.map, and the C function itoa pops into my head when I see std.range.iota. Until that "eureka" moment where it all falls into place, knowing which functions are used for what, and where to find them in Phobos, can be a challenging task. It's for this reason that some new D programmers tend to avoid ranges and algorithms altogether.

In this chapter, we're going to work on getting past that first hurdle with range-based functions in Phobos. We're going to look into how to use D ranges in a functional style and, in...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image