Functional Programming Course Released
We just launched our new “Learn Functional Programming” course, and frankly, I’m a bit exhausted (more on that later). This course is an interactive code-in-the-browser course that teaches the basics of FP in JavaScript and PureScript.
To celebrate this launch, we will be offering the course for free on signup (using the 250 free signup gems) for the entire month of October! Even if you can’t take the course this month, be sure to create an account and claim the offer :)
What’s In the Course?
There are 5 modules:
- Recursion
- Pure Functions
- Data Structures
- PureScript
- Higher Order Functions
The goal of the course is to cover the basics of FP in such a way that students can implement the concepts in any language, framework, or even just for theoretical practice. We go over functional versions of various algorithms and data structures, learn the difference between imperative and functional paradigms, and learn to curry functions using PureScript syntax.
The course has ~60 exercises currently, and like all of our courses, we will be adding to it and improving the quality regularly.
What the Hell is PureScript?
PureScript is a strongly-typed purely functional programming language that compiles to JavaScript. PureScript has a very Haskell-like syntax.
Example PureScript:
import Prelude
import Effect.Console (log)
greet :: String -> String
greet name = "Hello, " <> name <> "!"
main = log (greet "World")
I was originally intending this course to be written completely in JavaScript. The boot.dev platform already supported JavaScript and I thought I would be able to convey all of the basic FP concepts through JS, at least to a satisfactory degree.
I was wrong.
There are so many concepts that are hard to understand in functional programming if the language allows you to circumvent each rule. For example, in JavaScript you can write an immutable stack by exposing some functions:
function push(stack, s) {
newStack = [];
for (const item of stack) {
newStack.push(item);
}
newStack.push(s);
return newStack;
}
function pop(stack) {
newStack = [];
for (const item of stack) {
newStack.push(item);
}
newStack.pop();
return newStack;
}
function peek(stack) {
if (stack.length > 0) {
return stack[stack.length - 1];
}
return null;
}
The problem is there is nothing stopping another developer (or yourself) from “breaking the rules” and mutating the array later. That’s why I decided to teach myself some PureScript and implement it as part of the program!
I still think JavaScript has a useful part to play in the course, however, especially with the popularity of FP in front-end code. For example, take a look at Ramda and React Hooks.
Anyhow, be sure to take a look at the course and as always let us know how we can improve!
Related Articles
"Learn Algorithms" Course Released
Sep 14, 2020 by Lane Wagner - Boot.dev co-founder and backend engineer
We’ve launched our new Data Structures and Algorithms course! We wrote this course for engineers who need a refresher on computer science basics or want to learn the fundamentals for the first time.
Announcing a "Basic Intro to Coding" Course in JavaScript
Jul 06, 2020 by Lane Wagner - Boot.dev co-founder and backend engineer
The boot.dev app - our new gamified learning platform - just launched its first JavaScript coding course! This one is short, sweet, and to the point. We created a thirty-exercise, two-module course that caters to students who have never seen a single line of code before. That’s right, this is a code-in-the-browser course for absolute beginners.
Boot.dev Launches Golang Crash Course - Learn Go
Jul 02, 2020 by Lane Wagner - Boot.dev co-founder and backend engineer
We just launched the new boot.dev computer science platform and can’t be more excited. Our first crash course in Go, “Learn Go” is now available! We teach students by allowing them to write, compile, and run backend code directly in the browser.
Cryptography Trends And News Going Into 2020
Jan 03, 2020 by Lane Wagner - Boot.dev co-founder and backend engineer
Quantum Computing Quantum computing may not be coming quite as fast as some in the field had certainly feared (or perhaps hoped). Google did, however, solve an impressive problem this year.