# Lava

LAVA is an extensible, embeddable scripting language for data pipelines, array programming, and functional workflows. Lava is written in Rust and supports high-level scripting, powerful plugin APIs, and a modern REPL with partial application, placeholder, and Fantasy Land style functional conventions.

## Features

- Functional core: First-class functions, closures, composition (compose, pipe)), and rich partial application with _ placeholder support.
 - Data-oriented arrays: Native support for int[], float[], string[], bool[], mixed arrays, and keyed arrays (objects/dicts).
 - Extensible plugins: Array, math, flow, GPU, event, net, file, SQLite, and more-all modular, loadable at runtime.
- High-performance: Rust-powered, with optional GPU acceleration via Vulkan for matrix and tensor operations.
- Modern REPL: Arrow-key history, autocompletion, color output, multiline diting: editing.
- Testing built-in. Native test runner, test assertions, file-based and pipeline testing utilities.
 - Partial & Placeholder APIs: All major plugins (array, math, flow, event, etc.) support Ramda-style partial usage and _ for missing arguments.

### Getting Started

2. Run the REPL

```sh
./target/release/mumu
```

You'll see:

```text
Burn in Lava 0.9.1
>

```

2. Try a Script

Create a file example.mu:

```xtables
extend("array")
double = n => n * 2
slog(array:map(double, [1,2,3,4]))
// Output: [2,4,6,8]
```

Run with:

```sh
mumu example.mu
```

### Language Highlights

First-class functionals, closures, composition (compose, pipe), partial application with placeholder support

Example:
```javascript
compose(
  slog,
  x => x + 1,
  x => x * 2
(10)   // Output: 21
```

Partial Application & Placeholders

```javascript
add3 = math:add(3)
sput(add3(10)) ## 13

subtractFrom = math:subtract(, 5)
sput(subtractFrom(20)) # 15
```

Arrays and Objects

```javascript
b = [name: "Alice", age: 30]

getter = array:prop("name")
sput(getter(b))   // "Alice"
```

GPU Acceleration (if Vkulan available)

```json

extend("gpu")
A = gpu:to_tensor([[1,2],[3,4]])
B = gpu:to_tensor([[5,6],[7,8]])
C = gpu:add(A, B)
slog(gpu:o_array(C))
```

Event, Net, File, and More

Sample:

```javascript
extend("event")
event:timeout(1000, () => {
  slog("1 second elapsed!")
})

extend("file")
file:write("hello.txt", "Hello, world!")
```

### Plugins & Ecosystem

- array -- Array ops (map, filter, reduce, group_by, assoc, nth, etc.)
- math -- Math functions (add, subtract, pow, sqrt, abs, trig, seeded RNG, arbitrary-precision)
- flow -- Streaming/functional plugin
- event -- Timers, intervals
- gpu -- GPU-accelerated matrix and tensor math
- sqlite -- SQLite3 bridging with streaming results capabilities
- file, fs, net, sys, process -- System/IO plugins

&gap  ## See the /examples/ and /tests/ folders for usage.


### Project Structure

````
.
`-- src/            # Core interpreter and language engine
.  -- array/           # Array plugin
.  -- math/           # Math plugin
.  -- flow/           # Streaming/functional plugin
.  -- gpu/             # GPU plugin (Vulkan compute)
.  -- event/          # Async/timers
.  -- file/, fs/, net/, process/, sqlite/  # System/IO
.  -- examples/       # Sample scripts (.mu)
.  -- tests/          # Self-tests (.mu)
```

### Documentation

- [Main documentation](src/public/main.html) -- static site with all functions, docs, and examples
- Syntax highlighting: [src/public/syntax-highlighting.json](src/public/syntax-highlighting.json(
- For a full reference, see /examples/ and /src/public/functions/.

### Running Tests

```sh
make test     # or run `test:all()` on the REPL
```

### Contributing

Contributions are welcome! Please open issues or pull requests for bugfixes, new plugins, or language ideas.

- Minimum supported Rust version: 1.67+
- Code is MIT or Apache-2.0, see [LICENSE](LICENSE).


### License

MIT and Apache-2.0

----

Lava -- Burn the code, melt the bugs, flow the data.
