Step 1: Install Lambda Script

Download the binary from GitHub Releases, unzip, and add it to your PATH. See Download & Install for detailed instructions.

Verify the installation:

lambda --help

Step 2: Explore the REPL

Start the interactive REPL by running lambda with no arguments:

$ lambda
λ> 1 + 2
3

λ> [1, 2, 3] | ~ * 10
[10, 20, 30]

λ> let greeting = "Hello, Lambda Script!"
"Hello, Lambda Script!"

λ> len(greeting)
21

λ> quit

The REPL supports multi-line input. Type quit or exit to leave.

Step 3: Transform Data with Pipes

Create a file called hello.ls:

// hello.ls — Your first Lambda Script
let data = [
  {name: "Alice", age: 30, active: true},
  {name: "Bob",   age: 25, active: false},
  {name: "Carol", age: 35, active: true}
]

// Filter active users, extract names, sort
data that ~.active | ~.name | sort

Run it:

$ lambda hello.ls
["Alice", "Carol"]

Step 4: Parse and Convert Formats

Lambda Script can parse many formats into a unified tree and convert between them:

// Convert JSON to YAML
$ lambda convert data.json -t yaml -o data.yaml

// Convert Markdown to HTML
$ lambda convert readme.md -t html -o readme.html

// Convert LaTeX to HTML
$ lambda convert formula.tex -t html -o formula.html --full-document

You can also parse and transform inside scripts:

// transform.ls
let doc = input("readme.md", 'markdown')

// Query all images
let images = doc?<img>
images | ~.src

Step 5: Validate Data

Define a schema and validate JSON/YAML/HTML:

// schema.ls — A Lambda schema
type User = {
    name: string,
    age: int that (0 <= ~ <= 150),
    email: string?
}
$ lambda validate users.json -s schema.ls

HTML documents are validated automatically against the HTML5 schema (no -s needed):

$ lambda validate page.html

Step 6: Render and View Documents

Open any supported document in the native viewer:

$ lambda view                   # opens demo page
$ lambda view page.html         # open an HTML file
$ lambda view readme.md         # render Markdown
$ lambda view diagram.mmd       # render a Mermaid diagram
$ lambda view https://example.com

Render to image or PDF:

$ lambda render page.html -o output.svg
$ lambda render page.html -o output.pdf
$ lambda render page.html -o screenshot.png -vw 1920 -vh 1080

Step 7: Write a Document Pipeline

Combine parsing, transformation, and rendering in a single script:

// pipeline.ls — End-to-end document pipeline
let doc = input("report.md", 'markdown')

// Extract all headings
let headings = doc?<h1> ++ doc?<h2> ++ doc?<h3>

// Build a table of contents
let toc = <nav class: "toc"
    <h2 "Table of Contents">
    <ul (for (h in headings) <li <a href: ("#" ++ h.id); h[string]>>)>
>

// Wrap in styled HTML
<html
    <head <style "body { max-width: 800px; margin: 0 auto; font-family: sans-serif; }">>
    <body toc, doc>
>
$ lambda pipeline.ls | lambda render -o report.pdf

What's Next?