Kalandra

Learn

Your first program

A functional language for parallel and distributed programming. The next chapter of Clio.

A runnable project exports a function named main. The CLI and playground call that function and show its returned value.

Names and results

Use = to bind a value to a name. Arithmetic uses familiar operators such as + and *. A function returns its final expression; you do not need a return keyword.

Indent the body beneath fn. These lessons use two spaces. Source files use the .kalandra extension.

Try it

This program calculates six times seven, names the result answer, and returns it. Change either number and run it again.

main.kalandra

kalandra
export fn main:
  answer = 6 * 7
  answer

Expected result:

text
42

Try in playground

Run it locally

Install the CLI using the installation guide, then save the example above as main.kalandra in a new directory.

bash
kalandra run main.kalandra --strict

The result is 42. You can also use `kalandra new my-app` to start a project with two modules and a parallel function.

Installation and project setup

When something is wrong

Compiler errors prevent execution. In the playground, the diagnostic includes its code and a source location. Warnings may still allow a run. A failure while the program is running appears in the output panel.

Next: functions and pipes