This directory contains examples of MELP - an experimental lazy evaluation system for Mellea programs.
Basic introduction to MELP's lazy evaluation concepts.
Core lazy evaluation patterns and primitives.
Demonstrates lazy evaluation with Fibonacci sequence generation.
Sampling and evaluation strategies with lazy computations.
State management in lazy evaluation contexts.
- Lazy Evaluation: Deferring computation until results are needed
- Thunks: Suspended computations that can be evaluated later
- State Management: Handling state in lazy evaluation contexts
- Sampling Strategies: Combining lazy evaluation with sampling
- Composability: Building complex lazy programs from simple parts
MELP is an experimental feature that brings lazy evaluation to Mellea programs. It allows you to:
- Define computations without immediately executing them
- Compose complex workflows declaratively
- Optimize execution by avoiding unnecessary computations
- Implement advanced control flow patterns
# Define lazy computations
lazy_result = lazy_function(args)
# Compose lazy computations
composed = lazy_map(transform, lazy_result)
# Force evaluation when needed
actual_result = force(composed)- See
mellea/stdlib/functional.pyfor functional programming primitives - See
docs/dev/mellea_library.mdfor design philosophy