Fp
Functional programming resources
I've created quite a bit of FP related content in the past but it's somewhat scattered across different platforms and in different formats and I can't remember what or where it all is. So this is a...
Functions as first class citizens in SICP Lecture 1A
In my notes on part 4 of The Art and Science of CAP I make a number of references to functions as first class citizens, and show the parallel with queries also in CAP having that same first class...
Understanding jq's reduce function
It took me a bit of time to get my head around jq's reduce function. In this post I show how it relates to the equivalent function in JavaScript, which helped me understand it better, and might help...
ES6, reduce and pipe
In learning about functional programming, one thing that's worked for me is to take my time, and not rush over fundamental concepts. In fact, like a good beer or whisky, a fundamental concept is...
Functional programming - baby steps
There's a lot of talk about functional programming these days. Some of the language seems impenetrable at first - immutability, first class functions, functions as values, and so on. If you're a...
The beauty of recursion and list machinery
There are beautiful patterns inherent in the use of recursion that I've seen in my attempts to reboot my brain with a new, more functionally focused way of thinking about programming. This post...
F3C Parts 9 and 10 - Functors
FunFunFunction Videos: Functors - FunFunFunction #10 and Functors: I was WRONG! - FunFunFunction #11 (yes, the sequence numbers are a bit mixed up, don't worry though) (This post is part of the F3C...
F3C Part 8 - Promises
FunFunFunction Video: Promises - Part 8 of Functional Programming in JavaScript (This post is part of the F3C series) This video episode was recorded over a year ago. Since that time, a native...
F3C Part 7 - Recursion
FunFunFunction Video: Recursion - Part 7 of Functional Programming in JavaScript (This post is part of the F3C series) "Recursion is when a function calls itself, until it doesn't" --...
F3C Part 6 - Currying
FunFunFunction Video: Currying - Part 6 of Functional Programming in JavaScript (This post is part of the F3C series) The "what" part of currying is quite straightforward. The...
F3C - A FunFunFunction Companion Series
I came across a great YouTube video series on functional programming. It's by Mattias P Johansson ("MPJ" for short), whose YouTube channel is funfunfunction. Before you do anything else,...
F3C Part 5 - Closures
FunFunFunction Video: Closures - Part 5 of Functional Programming in JavaScript (This post is part of the F3C series) Functions have a signature (the parameters) and the body. The body is defined in a...
F3C Part 4 - Reduce advanced
FunFunFunction Video: Reduce advanced - Part 4 of Functional Programming in JavaScript (This post is part of the F3C series) Reduce is powerful, much more than its siblings. You can use it not only to...
F3C Part 3 - Reduce basics
FunFunFunction Video: Reduce basics - Part 4 of Functional Programming in JavaScript (This post is part of the F3C series) Higher-order functions map, filter and reject perform list transformations,...
F3C Part 2 - Map
FunFunFunction Video: Map - Part 2 of Functional Programming in JavaScript (This post is part of the F3C series) Moving on from the higher-order function filter in the previous video, another...
F3C Part 1 - Higher-order functions
FunFunFunction Video: Higher Order Functions - Part 1 of Functional Programming in JavaScript (This post is part of the F3C series) Functional programming makes you a better programmer because you're...
FOFP 2.1 A look at filter
Part of the Fundamentals of Functional Programming document. Prev: FOFP 1.5 Creating functions We've already seen our first higher-order function, map, in action. A close sibling is filter. filter has...
FOFP Fundamentals of functional programming
This document is for me to use during, and to distribute after, a lecture at Manchester's Xaverian College, where I'm very honoured to be able to help introduce some core concepts in functional...
FOFP 1.5 Creating functions
Part of the Fundamentals of Functional Programming document. Prev: FOFP 1.4 A different approach with map In our previous example, we defined a helper function square and used it like this: function...
FOFP 1.4 A different approach with map
Part of the Fundamentals of Functional Programming document. Prev: FOFP 1.3 Some basic list processing In our second attempt at basic list processing, we used the Array object's push function. There...
FOFP 1.3 Some basic list processing
Part of the Fundamentals of Functional Programming document. Prev: FOFP 1.2 Trying things out Let's explore the difference between imperative and functional programming approaches with the simple...
FOFP 1.2 Trying things out
Part of the Fundamentals of Functional Programming document. Prev: FOFP 1.1 Introduction To start exploring some of the fundamental concepts of functional programming, you don't need anything more...
FOFP 1.1 Introduction
Part of the Fundamentals of Functional Programming document. This document introduces some fundamental building blocks in the functional programming world. A definition Just so we start out on the...
Language minutiae and learning to SWIM
Further to Enlightenment in action, here's a tiny bit more light that I discovered on my journey up to Newcastle this morning. I solved 4Clojure puzzle 100 (Least Common Multiple) with this code: (fn...
Finding a wonderland number
I came across a simple puzzle this evening, on Wonderland Clojure Katas. My brain is half dead from starting work extra early and slogging through the day, but I wanted to include a tiny bit of...
Enlightenment in action
One of the ideas that Clojure embraces is this Perlism: It is better to have 100 functions operate on one data structure than 10 functions on 10 data structure This makes a lot of sense. But it also...
4Clojure Puzzle 66
In my quest to teach myself more Clojure, I'm solving puzzles. Puzzles from websites such as Project Euler and Advent of Code. More recently I've been plugging away at puzzles on 4Clojure. One of the...
Building blocks of language, structure and thought
As I travel on my path to perhaps what I deem as some sort of enlightenment, back in time via Clojure to one of the great ancestors of language, structure and computational thought (Lisp), I continue...
My journey to Clojure
I'm learning Clojure. Slowly, but hopefully surely. Clojure is a Lisp, which I like saying, because it makes me sound as though I know what I'm talking about and that my language experience is as old...