Lesson 13. Achieving code reuse in F#

We’re going to change tack a little in this lesson, and look at using functions (and type inference) in F# to create lightweight code reuse, and to pass functionality (rather than data) through a system. If you’ve used the LINQ framework at all, much of this lesson will be familiar to you. We’ll cover

  • How we tend to achieve reuse in the OO world
  • A quick review of the core parts of LINQ
  • Implementing higher-order functions in F#
  • Dependencies as functions

We always look to reuse code in our applications, because copy-and-paste is evil—right? Unfortunately, you know as well as I do that reuse at a low cost is sometimes really hard to achieve! There are many types of code reuse that we strive to achieve; this ...

Get Get Programming with F# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.