Quickstart
Welcome to Sema! This guide will get you up and running with the Sema CLI and REPL in under 5 minutes.
Prerequisites
Make sure you have installed the sema binary. If you haven't yet, follow the Installation Instructions on the homepage.
To verify your installation, check the version:
sema --version1. The Interactive REPL
The easiest way to explore Sema is using the interactive Read-Eval-Print Loop (REPL). Start it by running:
semaYou should see a prompt like sema>. Type an expression and press Enter to evaluate it:
sema> (+ 1 2)
3
sema> (define x 10)
x
sema> (* x 5)
50
sema> (exit)TIP
Use Ctrl+D or type (exit) to quit the REPL. The REPL also supports command history and auto-completions.
2. Running a Script
To write and execute scripts, save your Sema code to a file with the .sema extension.
Create a file named hello.sema with the following content:
(define name "World")
(println f"Hello, ${name}!")Run the file using the sema command:
sema hello.semaThis will output:
Hello, World!3. Inline Evaluation
You can evaluate expressions directly from your shell without opening the REPL or creating a file.
Evaluate an expression
Use the -e flag to evaluate an expression silently (it will only print if your code calls printing functions like println):
sema -e '(println "Sema is running!")'Evaluate and print the result
Use the -p flag to evaluate an expression and automatically print the result:
sema -p '(map #(* % %) (range 1 6))'Output:
(1 4 9 16 25)4. Quick LLM Call
Sema is designed around LLM integration. To try it, make sure you have an API key set in your environment (e.g., ANTHROPIC_API_KEY, OPENAI_API_KEY, or GEMINI_API_KEY).
Start the REPL and call the completion primitive:
sema> (llm/complete "Translate 'Lisp is beautiful' to French.")
"« Lisp est magnifique »"Next Steps
Now that you know how to run Sema, let's learn how to write it:
- Basic Syntax — S-expressions, variables, and collections
- Functions & Scope — How to define functions and run loops/recursion
- Concurrency & Async — Multi-threaded execution in the VM