Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning F# Functional Data Structures and Algorithms
  • Table Of Contents Toc
Learning F# Functional Data Structures and Algorithms

Learning F# Functional Data Structures and Algorithms

By : Adnan Masood
4 (9)
close
close
Learning F# Functional Data Structures and Algorithms

Learning F# Functional Data Structures and Algorithms

4 (9)
By: Adnan Masood

Overview of this book

If you have just started your adventure with F#, then this book will help you take the right steps to become a successful F# coder. An intermediate knowledge of imperative programming concepts, and a basic understanding of the algorithms and data structures in .NET environments using the C# language and BCL (Base Class Library), would be helpful.
Table of Contents (12 chapters)
close
close
11
Index

Enumerating a CSV file


As you probably have noticed by now, a sequence is quite a versatile data structure and we can use a file to populate a sequence. As seen in the next screenshot, I have created a tab-separated text file with the information about some programming languages, and their respective designers or creators:

Like various other methods specified earlier for populating a sequence, it can also easily be seeded by reading from the text file as follows:

let data = seq { use s = new System.IO.StreamReader("ProgrammingLanguages.txt")
  while not s.EndOfStream do yield s.ReadLine() }

And just like any other sequence, you can print the data by using the printfn method:

> data |> printfn "%A";;
seq
  ["C	Dennis MacAlistair Ritchie	1972"; "C++	Bjarne Stroustrup	1985";
   "C#	Anders Hejlsberg	2000"; "F#	Don Syme	2005"; ...]
val it : unit = ()
>

OK, now that we have this basic functionality out of our system, let's build something useful using sequences such as an XSV enumerator that...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning F# Functional Data Structures and Algorithms
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon