Language Guide
Welcome to the Kit programming language guide. Kit is a functional programming language designed for clarity, expressiveness, and safety. It features immutable data structures, pattern matching, algebraic data types, and a clean, readable syntax.
Quick Start
Installation
Set up Kit on your system and get ready to write your first program.
Hello World
Write and run your first Kit program in minutes.
Language Tour
A comprehensive overview of Kit's features with examples.
Language Features
Functional First
Kit embraces functional programming with first-class functions, immutable data,
and powerful list operations like map, filter, and fold.
# Transform data with functional operations
numbers = [1, 2, 3, 4, 5]
result = numbers
|> filter (fn(x) => x % 2 == 0)
|> map (fn(x) => x * x)
println result # => [4, 16]
Pattern Matching
Destructure data and handle different cases elegantly with pattern matching.
describe = fn(list) =>
match list
| [] -> "empty"
| [x] -> "single element: ${x}"
| [head | tail] -> "starts with ${head}"
println (describe [1, 2, 3]) # => "starts with 1"
Algebraic Data Types
Define your own types with variants for modeling complex domains.
type Shape = Circle Float | Rectangle Float Float | Triangle Float Float
area = fn(shape) =>
match shape
| Circle r -> Float.pi * r * r
| Rectangle w h -> w * h
| Triangle b h -> 0.5 * b * h
println (area (Circle 5.0)) # => 78.54...
Clean Syntax
Kit's syntax is designed to be readable and uncluttered, with minimal punctuation.
# Bindings are simple assignments
name = "Kit"
age = 1
# String interpolation
println "${name} is ${age} year old"
# Pipe operator for chaining
"hello world"
|> String.split " "
|> map String.capitalize
|> String.join " "
|> println # => "Hello World"
Learning Path
- Install Kit - Set up the compiler on your system
- Hello World - Write your first program
- Language Tour - Explore Kit's features and syntax
- Types - Understand Kit's type system and inference
- Functions - Learn about function definitions and closures
- Pattern Matching - Master destructuring and matching
- Standard Library - Explore built-in modules