Functional programming approaches to code design

The Motoko language sometimes takes a functional approach, as can be seen when making ’changes’ to immutable arrays
and when appending to lists

As a useful guide, Joachim Breitner’s Haskell series may be worth a review to get you thinking about functional programming when approaching your Motoko projects.

Joachim Breitner’s Haskell for Readers, includes a good primer on functional programming:
And his blog entry on this:

Joachim’s CIS 194 Haskell course at the University of Pennsylvania also contains a good overview of these concepts:


If and when you ever want to dive further into the technical design of functional data structures and algorithms, including complexity analysis of eager and lazy ones, I highly recommend Ravi Chugh’s lecture notes and example programs (all based on Elm, which is similar-ish to Motoko in broad ways):

That page gives the topic list, with links to example code and lecture notes.


That’s a great resource, thanks Matthew!