Lesson 52 of 55
12 mins readPython Comprehensive Functional Practice Challenges
In Plain English
Tackle practical challenges integrating pattern matching, custom ADTs, Functor/Applicative transformations, and tail-recursive algorithms.
Deep Dive: How It Works
Problem 1: Run-Length Encoding and Decoding on homogeneous lists.
Problem 2: Pure State evaluation of a Reverse Polish Notation (RPN) calculator.
Problem 3: Tree depth and tree map operations over recursive ADTs.
Core Rules to Remember

Multi-Concept Integration: Combine pure recursion, pattern matching, and typeclass instances.

Idiomatic Haskell Patterns: Point-free pipelines and zero-mutation data transformation.
Live Interactive Example
Hit Run Code to see it liveReverse Polish Notation (RPN) Calculator
Python 3.12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Output Console
Click "Run Code" to view the rendered output.
How it works: The pure stack fold evaluated the postfix expression.
Your Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Micro Exercise
Run Simple RPN Expression
Evaluate `solveRPN "3 4 + 2 *"` (which is `(3 + 4) * 2 = 14.0`).
Print `"RPN Result: "` followed by `show res`.
1
2
3
4
5
6
7
8
9
10
11
12
13
Sandbox Output
Click "Run & Check" to test your solution.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.