Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
Markdown
# KidLisp Language Reference
*Documentation for the KidLisp programming language in Aesthetic Computer*
## Overview
KidLisp is a Lisp-based visual programming language designed for creating interactive art and animations in Aesthetic Computer. It provides a simple, expressive syntax for graphics, animation, and user interaction.
## Basic Syntax
### S-Expressions
KidLisp uses S-expressions (parenthesized lists) where the first element is a function name followed by arguments:
```lisp
(function-name arg1 arg2 arg3)
```
### Comments
```lisp
; This is a comment
; Comments start with semicolon and go to end of line
```
### Multi-line Expressions
Expressions can span multiple lines for readability:
```lisp
(box 10 20
100 150
"outline")
```
## Core Language Features
### Variables
Define variables with `def`:
```lisp
(def x 10)
(def color "red")
(def size 50)
```
**Important**: Variable names cannot contain dashes/hyphens (-) as they are parsed as subtraction:
- ✅ Valid: `myVar`, `line_width`, `color2`
- ❌ Invalid: `my-var`, `line-width` (parsed as subtraction)
### Functions
Define reusable functions with `later`:
```lisp
(later square x y size
(box x y size size))
; Call the function
(square 50 50 100)
```
### Math Operations
```lisp
(+ 5 3 2) ; Addition: 10
(- 10 3) ; Subtraction: 7
(* 4 5 2) ; Multiplication: 40
(/ 20 4) ; Division: 5
```
## Graphics Functions
### Screen Management
```lisp
(wipe "black") ; Clear screen with color
(wipe 255 0 0) ; Clear with RGB red
(resolution 800 600) ; Set canvas size
```
### Drawing Colors
```lisp
(ink "red") ; Set color by name
(ink 255 0 0) ; Set RGB color
(ink "blue" 128) ; Set color with transparency
(ink 100 200 255 180) ; RGBA color
```
### Drawing Primitives
```lisp
(line 10 10 90 90) ; Draw line
(box 50 50 100 75) ; Draw rectangle
(circle 100 100 50) ; Draw circle
(tri 50 10 10 90 90 90) …