Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Functional & Logic Programming — Free Notes & Tutorial

Free Functional and Logic Programming notes for BTech CS — Haskell & GHCi, lambda calculus, graph reduction, type classes, algebraic types, Prolog, unification, logic grammars and search techniques, with all lab experiments solved. 100% free. Free Functional & Logic Programming course on SikshaSarovar.

This Functional & Logic Programming course is part of Siksha Sarovar and is 100% free for students in India — no sign-up required to read. It contains 17 structured lessons with examples, and pairs with our free online compiler and AI tutor.

What you will learn

  • Haskell
  • GHCi
  • Lambda calculus
  • Beta reduction
  • Combinators
  • Graph reduction
  • Pattern matching
  • Recursion
  • Type classes
  • Algebraic data types
  • Prolog
  • Unification
  • Backtracking
  • Cut
  • Findall
  • DCG grammars
  • DFS/BFS search

Course content (17 lessons)

  1. Course Introduction: Two New Ways of Thinking About Programs — Welcome to Functional & Logic Programming Until now, almost every program you have written has been imperative — a sequence of commands that change variables step by step. This…
  2. Unit 1: The Functional Paradigm & Getting Started with Haskell — 1.1 What is functional programming? In a functional language, a program is built entirely from expressions and function definitions . Computation means evaluating an expression to…
  3. Unit 1: Basic Types, Definitions & Designing Programs — 2.1 The basic types of Haskell Type Values Example literals :--- :--- :--- Bool truth values True , False Int fixed-size integers (at least 30 bits) 42 , -7 Integer…
  4. Unit 1: Tuples, Lists, Input/Output & Control Structures — 3.1 Tuples — fixed-size, mixed-type packages A tuple groups a fixed number of values that may have different types : For pairs, the standard projection functions are fst and snd :…
  5. Unit 1: The Lambda Calculus — Syntax, Conversions & Church–Rosser — 4.1 Why the lambda calculus? The lambda calculus (Alonzo Church, 1930s) is the mathematical core of every functional language. It has exactly three kinds of expression, yet it can…
  6. Unit 1: How Haskell Runs — Graph Reduction & the Three Instruction Machine — 5.1 From rewriting to running The lambda calculus says programs run by rewriting expressions . But real hardware runs instructions on memory. Graph reduction is the bridge:…
  7. Unit 2: Programming with Lists & Building Vocabulary — 1.1 Building vocabulary — the standard list toolkit Fluent Haskell programmers compose programs from a small, powerful vocabulary of list functions. Learn these with their types —…
  8. Unit 2: Pattern Matching & Recursion over Lists — 2.1 Pattern matching — branching on the shape of data A pattern appears on the left of a defining equation and does two jobs at once: it tests the shape of the argument and names…
  9. Unit 2: Overloading, Type Classes & Type Checking — 3.1 The problem: one symbol, many types == should work on Int , Char , Bool , lists... but not on functions (equality of functions is undecidable). + should work on Int and Double…
  10. Unit 2: Algebraic Data Types — 4.1 What "algebraic" means An algebraic data type (ADT) is built from two algebra-like operations: Sum ("or"): a value is one of several alternatives → multiple constructors.…
  11. Unit 3: Introduction to Logic Programming & Basic Constructs — 1.1 The logic programming idea A logic program does not describe how to compute. It states facts and rules about a world, and computation happens when you ask a query — the system…
  12. Unit 3: Database Programming & Recursive Programming — 2.1 Logic programs as databases A collection of facts is a relational database — predicates are tables, facts are rows: Rules then play the role of SQL queries and views:…
  13. Unit 3: The Computation Model, Theory & Applications of Logic Programs — 3.1 The abstract interpreter (SLD resolution) A logic program runs by SLD resolution (Selective Linear Definite-clause resolution). State = the current list of goals (the…
  14. Unit 4: Programming in Prolog — Syntax, Arithmetic & Control — 1.1 From theory to tool Unit 3 gave the model; this unit is hands-on Prolog (PROgramming in LOGique, Colmerauer & Roussel, 1972). Install SWI-Prolog (free, all platforms). Save…
  15. Unit 4: Structure Inspection & Second-Order Programming — 2.1 Structure inspection — programs that examine terms Prolog terms are data structures you can take apart at runtime. The inspection built-ins: Type tests: Test Succeeds when…
  16. Unit 4: Logic Grammars & Search Techniques — 3.1 Logic grammars — parsing by deduction Prolog was born for language processing. A context-free grammar can be written almost verbatim as a DCG (Definite Clause Grammar) using…
  17. Lab Practicals: Haskell & Prolog Experiments — How to use this lesson The lab list for this subject has two halves — Haskell (experiments 1–6) and Prolog (experiments 7–10). Each practical below names the theory lesson it…

Course Introduction: Two New Ways of Thinking About Programs

Welcome to Functional & Logic Programming

Until now, almost every program you have written has been imperative — a sequence of commands that change variables step by step. This course introduces two radically different paradigms:

  • Functional programming (Haskell): a program is a collection of mathematical functions. There are no assignment statements, no loops, and no changing state — only expressions that are evaluated.
  • Logic programming (Prolog): a program is a collection of facts and rules. You don't tell the computer how to compute an answer — you describe what is true, ask a question, and the system searches for the answer itself.

The paradigm map

How this course is organised

Syllabus blockLessons that cover it
Intro to FP, Haskell & GHCi, basic types, designing programsUnit 1 → "The Functional Paradigm" and "Basic Types & Definitions"
Data types, tuples, lists, input/output, control structuresUnit 1 → "Tuples, Lists, I/O & Control Structures"
Lambda calculus: syntax, conversions, normal forms, Church–Rosser, combinatorsUnit 1 → "The Lambda Calculus"
Graph reduction, Three Instruction MachineUnit 1 → "How Haskell Runs: Graph Reduction & the TIM"
Programming with lists, building vocabulary, functions over listsUnit 2 → "Programming with Lists"
Pattern matching and recursionUnit 2 → "Pattern Matching & Recursion"
Overloading, type classes, type checkingUnit 2 → "Overloading, Type Classes & Type Checking"
Algebraic typesUnit 2 → "Algebraic Data Types"
Intro to logic programming, basic constructsUnit 3 → "Introduction to Logic Programming"
Database & recursive programmingUnit 3 → "Database & Recursive Programming"
Computation model, theory & applications of logic programsUnit 3 → "The Computation Model of Logic Programs"
Prolog: introduction, programming, arithmetic, structure inspectionUnit 4 → "Programming in Prolog" and "Structure Inspection"
Second-order programming, logic grammars, search techniquesUnit 4 → "Second-Order Programming" and "Logic Grammars & Search"
Lab experiments (Haskell + Prolog)"Lab Practicals" lesson at the end

Why learn paradigms you may never "use at work"?

  1. They change how you think. Recursion, immutability and pattern matching — once they click in Haskell — make you a better Java/Python programmer too.
  2. Mainstream languages are absorbing them. Lambdas in Java, list comprehensions in Python, Option/Result types in Rust, LINQ in C# —

Continue reading: Course Introduction: Two New Ways of Thinking About Programs →

Frequently asked questions

Is the Functional & Logic Programming course really free?

Yes. The entire Functional & Logic Programming course on Siksha Sarovar is free to read with no account required. You can optionally sign in with Google to save your progress.

Do I get a certificate for Functional & Logic Programming?

Yes — finish the lessons and pass the quiz to earn a free, verifiable certificate you can share on LinkedIn or with recruiters.

Can I run code while learning?

Yes. The built-in online compiler runs C, C++, Python, Java, PHP, JavaScript, C# and SQL directly in your browser — no installation needed.