Rayforce ← Back to home
GitHub

Quick Start

Build Rayforce from source, start the Rayfall REPL, and run your first query in under 5 minutes.

Prerequisites

Rayforce is a pure C17 library with zero external dependencies. You need:

Build from Source

Clone the repository and build:

git clone https://github.com/RayforceDB/rayforce.git
cd rayforce

Debug Build (default)

The default build enables AddressSanitizer (ASan) and UndefinedBehaviorSanitizer (UBSan) for maximum safety during development:

make

Release Build

Optimized build with -O3 and no sanitizers:

make release

Run Tests

Rayforce ships with a comprehensive test suite covering every subsystem:

# Run all tests
make test

# Run a single test suite
./rayforce.test --suite /vec

# Run tests matching a pattern
./rayforce.test --suite /lang

Start the REPL

The Rayfall REPL provides an interactive environment with syntax highlighting, bracket matching, tab completion, and multi-line input:

./rayforce

You will see the prompt (a green triangle bullet):

Your First Table

Create a table with two columns using the table function. Column names are symbols (quoted identifiers), and column data are vectors:

 (set t (table [x y] (list [1 2 3] [A B C])))
┌─────┬───────────────────────────────┐
│  x  │               y               │
│ i64 │              sym              │
├─────┼───────────────────────────────┤
│ 1   │ A                             │
│ 2   │ B                             │
│ 3   │ C                             │
├─────┴───────────────────────────────┤
│ 3 rows (3 shown) 2 columns (2 shown)│
└─────────────────────────────────────┘

Your First Query

Use select to query the table. The where: clause filters rows, and you can project specific columns:

 (select {from:t where: (> x 1)})
┌─────┬───────────────────────────────┐
│  x  │               y               │
│ i64 │              sym              │
├─────┼───────────────────────────────┤
│ 2   │ B                             │
│ 3   │ C                             │
├─────┴───────────────────────────────┤
│ 2 rows (2 shown) 2 columns (2 shown)│
└─────────────────────────────────────┘

Add computed columns and aggregations:

; Select with a computed column
 (select {from:t x:x x2: (* x x)})
┌─────┬───────────────────────────────┐
│  x  │              x2               │
│ i64 │              i64              │
├─────┼───────────────────────────────┤
│ 1   │ 1                             │
│ 2   │ 4                             │
│ 3   │ 9                             │
├─────┴───────────────────────────────┤
│ 3 rows (3 shown) 2 columns (2 shown)│
└─────────────────────────────────────┘

; Group by and aggregate
 (select {from:t by: y total: (sum x)})
┌─────┬───────────────────────────────┐
│  y  │             total             │
│ sym │              i64              │
├─────┼───────────────────────────────┤
│ A   │ 1                             │
│ B   │ 2                             │
│ C   │ 3                             │
├─────┴───────────────────────────────┤
│ 3 rows (3 shown) 2 columns (2 shown)│
└─────────────────────────────────────┘

Load a CSV File

Load data from CSV files with automatic type inference, parallel parsing, and null handling:

 (set data (.csv.read "trades.csv"))
 (select {from:data where: (> price 100)})

Run a Script

Rayfall scripts use the .rfl extension. Run them directly from the command line:

# Run an example script
./rayforce examples/rfl/pivot.rfl

# Run your own script
./rayforce my-analysis.rfl

REPL Commands

The REPL supports several built-in commands:

Command Description
:helpShow available commands
:timeit exprBenchmark an expression
:envList all global bindings
:clearClear the screen
:quitExit the REPL

What's Next