Haskell - Solving Linear Diophantine Equations - Part 1
🧩 Learn Functional Programming by solving a real puzzle! We look at a tricky math problem: if red shirts cost $18 and black shirts cost $11, and you spent exactly $1188, how many of each did you buy? Then, we switch to VS Code to model this equation in Haskell using custom Data Types and write a "checker" function to verify our guesses. 📚 What you will learn: - How to define custom Data Types (data) in Haskell - How to model a Linear Diophantine Equation (ax + by = c) - How to use Pattern Matching to extract values - How to write a checkSolution function to test your guesses - How to make your output readable with a prettyPrint function 🧪 Tech stack: - Haskell (GHCi) - VS Code 🧮 The set of videos for Solving Linear Diophantine Eqations: Haskell - Solving Linear Diophantine Equations - Part 1: this one! Haskell - Solving Linear Diophantine Equations - Part 2: https://youtu.be/rSo-Lb5D2rc Haskell - Solving Linear Diophantine Equations - Part 3: https://youtu.be/GVX1lhTl7OA 📍 Links 📝 VitoshAcademy blog: https://www.vitoshacademy.com/haskell-solving-diophantine-equation/ 📝 GitHub code: https://github.com/Vitosh/Haskell/blob/main/code/02_LDE.hs 👍 Like, 💬 Comment, and 🔔 Subscribe for more real-world programming tutorials. #haskell #functionalprogramming #math #beginners #coding
Download
0 formatsNo download links available.