Book Image

Learning F# Functional Data Structures and Algorithms

By : Adnan Masood
Book Image

Learning F# Functional Data Structures and Algorithms

By: Adnan Masood

Overview of this book

Table of Contents (21 chapters)
Learning F# Functional Data Structures and Algorithms
Credits
Foreword
Foreword
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7. Jumping the Queue

 

"A list is only as strong as its weakest link."

 
 -- Donald Knuth
 

"There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies."

 
 -- C.A.R. Hoare

In this chapter, we will discuss a custom functional implementation of a queue. We will then introduce the FSharpX open source collection of functional data structures. Finally, we will explore the F# agent MailboxProcessor for creating async work flows, throttling, and post-processing the results of asynchronous calls as an example usage of a queue.

In this chapter, we will cover the following topics:

  • Queue data structure, typical applications using stacks

  • Custom implementation versus the collection already available and the concurrent collection structures

  • Using MailboxProcessor for throttling and scheduling a message queue

A queue is a widely used data structure...