boxlang-functional-programming
Installation
SKILL.md
BoxLang Functional Programming
Overview
BoxLang treats functions as first-class values. Functions can be stored in variables, passed as arguments, returned from other functions, and used in functional pipelines. BoxLang supports closures, lambdas, and arrow functions with a clean, expressive syntax.
Closures vs Lambdas — Critical Distinction
This distinction matters for correctness:
| Syntax | Name | Scope Capture | Use When |
|---|---|---|---|
(args) => expr |
Closure | ✅ Yes — captures surrounding scope | Accesses outer variables or calls external functions/BIFs |
(args) -> expr |
Lambda | ❌ No — only uses its own args | Purely deterministic; only works with passed arguments |
function(...) {} |
UDF/Closure | ✅ Yes — when assigned to a variable/returned | Named or complex multi-line function bodies |