lea
Use when writing or modifying Lea code - pipe-oriented functional language with tree-walk interpreter
When & Why to Use This Skill
This Claude skill empowers the assistant to write, refactor, and optimize code in Lea, a specialized pipe-oriented functional programming language. By understanding Lea's unique tree-walk interpreter architecture, pipe syntax (/>), and advanced features like decorators and context-based bindings, this skill ensures high-quality, idiomatic functional script generation.
Use Cases
- Case 1: Generating complex data processing pipelines using Lea's pipe operator (/>) to chain filters, maps, and reductions for readable functional code.
- Case 2: Implementing resilient and optimized functions by applying built-in decorators such as #memo for caching and #retry for automated error handling.
- Case 3: Managing global state and dependency injection within Lea scripts using Contexts and the @Name attachment syntax.
- Case 4: Debugging and modifying existing Lea codebases by interpreting the specific indentation-based logic and tree-walk execution patterns.
| name | lea |
|---|---|
| description | Use when writing or modifying Lea code - pipe-oriented functional language with tree-walk interpreter |
Lea Language
Quick Start
let numbers = [1, 2, 3, 4, 5]
let result = numbers
/> filter((x) -> x > 2)
/> map((x) -> x * x)
/> reduce(0, (acc, x) -> acc + x)
result /> print
Core Principles
- Pipes:
value /> fnpasses value as first arg; useinputplaceholder to control position - Functions:
let double = (x) -> x * 2(no fn keyword) - Multi-statement bodies: Indentation-based or brace-delimited
{ } - Decorators: Trailing
#log #memo #time #retry(3)etc. after function body - Bindings:
let x = 10immutable,maybe x = 0mutable - Records:
{ name: "Max", age: 99 }with member accessrecord.field - Contexts:
context Name = default+provide Name value+@Nameattachments
Builtins
- Math:
sqrt,abs,floor,ceil,round,min,max - Lists:
length,head,tail,push,concat,map,filter,reduce,range - IO:
print(returns first arg for chaining) - Async:
delay(ms)— promise that resolves after ms
Running
npm run repl # Interactive REPL
npm run lea file.lea # Run a file
Reference Files
- references/syntax.md - Full syntax reference
- references/architecture.md - Interpreter internals