A Miranda implementation of solutions to exercises from "Introduction to Functional Programming" by Richard Bird and Philip Wadler.
This repository contains working Miranda code and test suites to help understand functional programming concepts through the Miranda programming language.
This project attempts to transform exercise solutions into a proper Miranda codebase with:
- Modular source code organization
- Comprehensive test coverage
- Build system and automation
- Installation and setup documentation
├── src/ # Source code by chapter
│ ├── chapter01/
│ │ └── exercises.m # Chapter 1 solutions
│ └── main.m # Main entry point
├── tests/ # Test suites organized by chapter
│ ├── chapter01/
│ │ └── test_runner.m # Chapter 1 tests
│ └── validate.sh # Project validation script
├── INSTALL.md # Miranda installation guide
├── Makefile # Build automation
└── README.md # This file
See INSTALL.md for detailed installation instructions.
Quick install (if you have Miranda sources):
make cleanup
make# Check project structure and validate Miranda code
./tests/validate.sh# Run main program with all exercises
make run
# Run test suite (executes each chapter's tests)
make test# Start Miranda interpreter with the main module
cd src
mira main.m
# In Miranda REPL:
mira> quad 3
81
mira> max 5 2
5
mira> circle_area 7
154The project includes a comprehensive test suite:
# Run all tests
make test
# Validate project structure
./tests/validate.sh
# Check basic functionality
make check-
Create chapter source file:
# For chapter N touch src/chapterN/exercises.m -
Implement Miranda functions:
%export function_name function_name param = implementation -
Add tests:
# In tests/chapterNN/test_runner.m test_function_cases = [ test_eq expected (function_name input) "description" ]
| Command | Description |
|---|---|
make help |
Show available commands |
make run |
Execute main program |
make test |
Run test suite |
make check |
Validate installation and functionality |
make clean |
Clean generated files |
- Miranda interpreter (open source since 2020)
- C compiler (gcc/clang for building Miranda)
- UNIX-like system (Linux, macOS, WSL)
- Title: Introduction to Functional Programming
- Authors: Richard Bird, Philip Wadler
- Publisher: Prentice Hall International Series in Computer Science