Skip to content
AgileLogics
Intermediate 5 min read

Intermediate Projects

Prerequisites: Level 2 — Intermediate

Build these using records, discriminated unions, Result, modules, files, and active patterns from Level 2.

1. Bank Account Ledger

Model transactions as a discriminated union (Deposit, Withdrawal, Transfer), replay a list of them with List.fold to compute balances, and return Error instead of throwing when a withdrawal would overdraw an account. Save and load the ledger as CSV.

2. Expression Calculator

Define a union for arithmetic expressions (Number, Add, Multiply, Divide, Variable), write a recursive evaluate that looks variables up in a Map, and a simplify function that rewrites x * 1 and x + 0. Add a tiny parser for strings like "2 * (x + 3)".

3. Log Analyzer

Read a log file line by line with File.ReadLines, parse each line with an active pattern built on a regular expression, and report counts per level and the slowest requests. Keep parsing, analysis, and printing in separate modules.

4. To-Do List With Validation

Build a command-line to-do app with records for tasks and single-case unions for validated values (a non-empty title, a due date in the future). Collect validation errors as a Result and store the list in a JSON or text file between runs.