# Functional programming approaches to code design

**URL:** <https://forum.dfinity.org/t/functional-programming-approaches-to-code-design/64>\
**Category:** Language Support\
**Tags:** Education\
**Created:** [November 12, 2019, 8:59pm UTC](https://forum.dfinity.org/t/functional-programming-approaches-to-code-design/64 "2019-11-12T20:59:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@Ori](https://forum.dfinity.org/u/Ori)\
**Post date:** [November 12, 2019, 8:59pm UTC](https://forum.dfinity.org/t/functional-programming-approaches-to-code-design/64/1 "2019-11-12T20:59:07Z")

</div>

The Motoko language sometimes takes a functional approach, as can be seen when making ’changes’ to immutable arrays  
https://sdk.dfinity.org/language-guide/index.html#immutable-arrays  
and when appending to lists  
https://sdk.dfinity.org/language-guide/index.html#stdlib-list

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:  
http://haskell-for-readers.nomeata.de/  
And his blog entry on this:  
http://www.joachim-breitner.de/blog/750-Teaching\_to\_read\_Haskell

Joachim’s CIS 194 Haskell course at the University of Pennsylvania also contains a good overview of these concepts:  
http://cis.upenn.edu/~cis194/fall16/

---

<div class="post-metadata">

**Author:** ![matthewhammer](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/matthewhammer/32/323_2.png) [@matthewhammer](https://forum.dfinity.org/u/matthewhammer)\
**Post date:** [December 5, 2019, 6:24pm UTC](https://forum.dfinity.org/t/functional-programming-approaches-to-code-design/64/2 "2019-12-05T18:24:47Z")

</div>

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):

[https://www.classes.cs.uchicago.edu/archive/2019/spring/22300-1/schedule.html](https://www.classes.cs.uchicago.edu/archive/2019/spring/22300-1/schedule.html)

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

---

<div class="post-metadata">

**Author:** ![Ori](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@Ori](https://forum.dfinity.org/u/Ori)\
**Post date:** [December 5, 2019, 7:13pm UTC](https://forum.dfinity.org/t/functional-programming-approaches-to-code-design/64/3 "2019-12-05T19:13:35Z")

</div>

That’s a great resource, thanks Matthew!
