Monorepo for Aesthetic.Computer
aesthetic.computer
1% !TEX program = xelatex
2\documentclass[10pt,letterpaper,twocolumn]{article}
3
4\usepackage[top=0.75in, bottom=0.75in, left=0.75in, right=0.75in]{geometry}
5\usepackage{fontspec}
6\usepackage{unicode-math}
7\setmainfont{Latin Modern Roman}
8\setsansfont{Latin Modern Sans}
9\newfontfamily\acbold{ywft-processing-bold}[Path=../../system/public/type/webfonts/,Extension=.ttf]
10\newfontfamily\aclight{ywft-processing-light}[Path=../../system/public/type/webfonts/,Extension=.ttf]
11\newfontfamily\kidlispfont{ComicRelief-Regular}[
12 Path=../arxiv-kidlisp/fonts/,
13 Extension=.ttf
14]
15\newfontfamily\kidlispbold{ComicRelief-Bold}[
16 Path=../arxiv-kidlisp/fonts/,
17 Extension=.ttf
18]
19\setmonofont{Latin Modern Mono}[Scale=0.85]
20
21\usepackage{xcolor}
22\usepackage{titlesec}
23\usepackage{enumitem}
24\usepackage{booktabs}
25\usepackage{tabularx}
26\usepackage{multicol}
27\usepackage{fancyhdr}
28\usepackage{hyperref}
29\usepackage{graphicx}
30\graphicspath{{figures/}{../../papers/arxiv-ac/figures/}}
31\usepackage{ragged2e}
32\usepackage{microtype}
33\usepackage{listings}
34\usepackage{natbib}
35\usepackage[colorspec=0.92]{draftwatermark}
36
37% === COLORS ===
38\definecolor{acpink}{RGB}{180,72,135}
39\definecolor{acpurple}{RGB}{120,80,180}
40\definecolor{acdark}{RGB}{64,56,74}
41\definecolor{acgray}{RGB}{119,119,119}
42\definecolor{klbrand}{RGB}{205,92,155} % kidlisp.com primary (--ac-purple)
43\definecolor{klcyan}{RGB}{112,214,255} % kidlisp.com ".com" cyan (#70D6FF)
44\definecolor{kldark}{RGB}{48,43,58} % kidlisp.com dark purple
45\definecolor{draftcolor}{RGB}{205,92,155}
46
47% KidLisp syntax colors
48\definecolor{klparen}{RGB}{140,140,160}
49\definecolor{klkw}{RGB}{119,51,170}
50\definecolor{klfn}{RGB}{0,136,170}
51\definecolor{klcolor}{RGB}{204,80,0}
52\definecolor{klnum}{RGB}{204,0,102}
53\definecolor{klstr}{RGB}{44,145,44}
54\definecolor{klcmt}{RGB}{140,140,140}
55\definecolor{klvar}{RGB}{50,50,50}
56\definecolor{klspecial}{RGB}{180,72,135}
57\definecolor{klbg}{RGB}{250,248,252}
58
59\DraftwatermarkOptions{text=WORKING DRAFT,fontsize=3cm,color=draftcolor!18,angle=45}
60
61\hypersetup{colorlinks=true,linkcolor=acpurple,urlcolor=acpurple,citecolor=acpurple,
62 pdftitle={KidLisp Language Reference: 118 Built-ins in 12 Categories}}
63
64\titleformat{\section}{\normalfont\bfseries\normalsize\uppercase}{\thesection.}{0.5em}{}
65\titlespacing{\section}{0pt}{1.2em}{0.3em}
66\titleformat{\subsection}{\normalfont\bfseries\small}{\thesubsection}{0.5em}{}
67\titlespacing{\subsection}{0pt}{0.8em}{0.2em}
68
69\pagestyle{fancy}\fancyhf{}
70\renewcommand{\headrulewidth}{0pt}
71\fancyhead[C]{\footnotesize\color{acpink}\textit{Working Draft --- not for citation}}
72\fancyfoot[C]{\footnotesize\thepage}
73
74\newcommand{\ac}{\textsc{Aesthetic.Computer}}
75% Random caps for Aesthetic.Computer branding
76\newcount\acrandtmp
77\newcommand{\acrandletter}[2]{%
78 \acrandtmp=\uniformdeviate 2\relax
79 \ifnum\acrandtmp=0\relax#1\else#2\fi%
80}
81\newcommand{\acrandname}{%
82 \acrandletter{a}{A}\acrandletter{e}{E}\acrandletter{s}{S}\acrandletter{t}{T}%
83 \acrandletter{h}{H}\acrandletter{e}{E}\acrandletter{t}{T}\acrandletter{i}{I}%
84 \acrandletter{c}{C}{\color{acpink}.}\acrandletter{c}{C}\acrandletter{o}{O}%
85 \acrandletter{m}{M}\acrandletter{p}{P}\acrandletter{u}{U}\acrandletter{t}{T}%
86 \acrandletter{e}{E}\acrandletter{r}{R}%
87}
88\newcommand{\kl}{\textsc{KidLisp}}
89
90% === KIDLISP LISTING STYLE ===
91\lstdefinelanguage{kidlisp}{
92 morekeywords=[1]{def,if,repeat,once,later,die,let,do,fn},
93 morekeywords=[2]{wipe,ink,line,box,circle,tri,plot,flood,shape,write,type,paste,print},
94 morekeywords=[3]{scroll,zoom,spin,blur,contrast,suck,pan,sort,resetSpin,smoothspin,unpan,fill,outline,stroke,nofill,nostroke},
95 morekeywords=[4]{random,wiggle,sin,cos,tan,floor,ceil,round,abs,sqrt,min,max,mod},
96 morekeywords=[5]{width,height,frame,time,resolution,fps,screen,pen,hand,gamepad,mic,amplitude},
97 morekeywords=[6]{cube,form,trans,move,scale,hop,delay,jump,melody,overtone,speaker,sound},
98 morekeywords=[7]{embed,layer,fade,bake,list,get,set,tap},
99 sensitive=true,
100 morecomment=[l]{;},
101 morestring=[b]",
102 literate=
103 {(}{{{\color{klparen}(}}}1
104 {)}{{{\color{klparen})}}}1
105 {\$}{{{\color{klspecial}\$}}}1,
106}
107
108\lstdefinestyle{kidlispstyle}{
109 language=kidlisp,
110 basicstyle=\ttfamily\small,
111 keywordstyle=[1]\color{klkw}\bfseries,
112 keywordstyle=[2]\color{klfn}\bfseries,
113 keywordstyle=[3]\color{acpurple},
114 keywordstyle=[4]\color{klnum},
115 keywordstyle=[5]\color{klspecial},
116 keywordstyle=[6]\color{klfn},
117 keywordstyle=[7]\color{acpink},
118 commentstyle=\color{klcmt}\itshape,
119 stringstyle=\color{klstr},
120 numberstyle=\tiny\color{klcmt},
121 breaklines=true,
122 frame=single,
123 rulecolor=\color{acgray!30},
124 backgroundcolor=\color{klbg},
125 xleftmargin=0.5em,
126 xrightmargin=0.5em,
127 aboveskip=0.5em,
128 belowskip=0.5em,
129 showstringspaces=false,
130}
131
132\lstset{style=kidlispstyle}
133
134\setlist[itemize]{nosep, leftmargin=1.2em, itemsep=0.1em}
135\setlength{\columnsep}{1.8em}
136\setlength{\parindent}{1em}
137\setlength{\parskip}{0.3em}
138
139% Hyphenation for narrow two-column layout
140\tolerance=800
141\emergencystretch=1em
142\hyphenpenalty=50
143
144\begin{document}
145
146\twocolumn[{%
147\begin{center}
148\includegraphics[height=4em]{pals}\par\vspace{0.5em}
149{\kidlispbold\fontsize{26pt}{30pt}\selectfont\color{kldark} Kid{\color{klbrand}Lisp} Language Reference}\par
150\vspace{0.2em}
151{\kidlispfont\fontsize{11pt}{13pt}\selectfont\color{klbrand} 118 Built-ins in 12 Categories for Generative Art}\par
152\vspace{0.3em}
153{\kidlispfont\fontsize{9pt}{11pt}\selectfont\color{acgray} Syntax, Semantics, Timing, Color, and the \texttt{\$}-Code Composition System}\par
154\vspace{0.6em}
155{\normalsize\href{https://prompt.ac/@jeffrey}{@jeffrey}}\par
156{\small\color{acgray} Aesthetic.Computer}\par
157{\small\color{acgray} ORCID: \href{https://orcid.org/0009-0007-4460-4913}{0009-0007-4460-4913}}\par
158\vspace{0.3em}
159{\small\color{acpurple} \url{https://aesthetic.computer}}\par
160\vspace{0.6em}
161\rule{\textwidth}{1.5pt}
162\vspace{0.5em}
163\end{center}
164
165\begin{center}
166{\small\color{acpink}\textbf{[ working draft --- not for citation ]}}
167\end{center}
168\vspace{0.3em}
169
170\begin{quote}
171\small\noindent\textbf{Abstract.}
172\kl{} is a minimal Lisp dialect for generative art with 118 built-in functions across 12 categories, no user-defined functions, no recursion, no file I/O, and no networking. It is safe by construction: a \kl{} program cannot break out of its sandbox, crash its host, or access resources beyond its canvas. This paper serves as a complete language reference, documenting every built-in function with syntax-highlighted examples, the timing system (frame-based and second-based scheduling without callbacks), the color model (named colors, RGB, gradients, patterns), the \texttt{\$}-code composition system (embedding programs by reference as the primary abstraction mechanism), and the evaluation model (full AST re-evaluation every frame with deterministic PRNG). We present \kl{} as a language designed around \emph{omission}: what it cannot do is as deliberate as what it can, and the constraints produce a creative space that 59 authors have used to write 16,634 programs.
173\end{quote}
174\vspace{0.5em}
175}]
176
177\section{Syntax}
178
179\kl{} uses S-expression syntax~\citep{mccarthy1960recursive}. Every expression is either an atom (number, string, symbol) or a list enclosed in parentheses:
180
181\begin{lstlisting}
182; Atoms
18342 ; number
184"hello" ; string
185red ; symbol (color name)
186
187; Lists (function application)
188(wipe "navy") ; clear screen navy
189(ink "red") ; set drawing color
190(box 10 10 50 50) ; draw rectangle
191(circle 64 64 30) ; draw circle
192\end{lstlisting}
193
194There are no operators, no infix notation, no special syntax beyond parentheses, strings, numbers, and symbols. Arithmetic uses prefix notation:
195
196\begin{lstlisting}
197(+ 1 2) ; => 3
198(* 3 (+ 1 2)) ; => 9
199(- 10 3) ; => 7
200(/ 100 4) ; => 25
201(% 17 5) ; => 2 (modulo)
202\end{lstlisting}
203
204\section{The 12 Categories}
205
206\subsection{Graphics (9 functions)}
207
208Drawing primitives operate in immediate mode---each call renders directly to the framebuffer.
209
210\begin{lstlisting}
211(wipe "black") ; clear canvas
212(ink "cyan") ; set color
213(line 0 0 128 128) ; diagonal line
214(box 10 10 40 40) ; rectangle
215(circle 64 64 20) ; circle at center
216(tri 32 10 10 54 54 54) ; triangle
217(plot 64 64) ; single pixel
218(flood 64 64) ; flood fill
219(shape 10 10 50 10 30 50) ; polygon
220\end{lstlisting}
221
222\texttt{fill} and \texttt{outline} control whether shapes are solid or stroked (Processing-compatible):
223
224\begin{lstlisting}
225(fill) ; filled shapes
226(ink "red")
227(circle 64 64 30) ; solid red circle
228
229(outline) ; outlined shapes
230(ink "white")
231(circle 64 64 30) ; white ring
232\end{lstlisting}
233
234\subsection{Transformations (11 functions)}
235
236Pixel-level transformations operate on the framebuffer after drawing:
237
238\begin{lstlisting}
239(scroll 1 0) ; shift pixels right
240(zoom 1.01) ; slow zoom in
241(spin 1) ; rotate 1 degree
242(blur 2) ; gaussian blur
243(contrast 1.2) ; increase contrast
244(suck 0.5) ; radial displacement
245(sort) ; sort pixels by brightness
246\end{lstlisting}
247
248Transformations \emph{accumulate} across frames, producing animation without explicit state management:
249
250\begin{lstlisting}
251(wipe "black")
252(ink "white")
253(circle 64 64 10) ; draw circle
254(spin 2) ; rotate 2 deg/frame
255(zoom 1.005) ; grow slightly/frame
256; Result: spiraling, growing circle
257\end{lstlisting}
258
259\subsection{Math (14 functions)}
260
261\begin{lstlisting}
262(sin (* frame 0.05)) ; sine wave
263(cos (* frame 0.03)) ; cosine wave
264(random) ; 0-255
265(random 10) ; 0-9
266(random 5 15) ; 5-14
267(wiggle 10) ; random +/-5
268(floor 3.7) ; => 3
269(abs -5) ; => 5
270(sqrt 16) ; => 4
271(min 3 7 1) ; => 1
272(max 3 7 1) ; => 7
273\end{lstlisting}
274
275\texttt{random} uses a seeded PRNG initialized from the program's short code, making all generative output \textbf{deterministic}: the same program always produces the same visual.
276
277\subsection{Color (19+ named colors)}
278
279Colors can be specified as names, RGB values, or gradient strings:
280
281\begin{lstlisting}
282(ink "red") ; named color
283(ink 255 0 0) ; RGB
284(ink 255 0 0 128) ; RGBA (semi-transparent)
285(ink "fade:red-blue") ; horizontal gradient
286(ink (fade "cyan" "magenta" "vertical"))
287(ink "rainbow") ; repeating rainbow
288(ink "zebra") ; striped pattern
289\end{lstlisting}
290
291Available color names include all CSS named colors: \texttt{red}, \texttt{green}, \texttt{blue}, \texttt{yellow}, \texttt{orange}, \texttt{purple}, \texttt{pink}, \texttt{cyan}, \texttt{magenta}, \texttt{black}, \texttt{white}, \texttt{gray}, \texttt{brown}, \texttt{lime}, \texttt{navy}, \texttt{teal}, \texttt{gold}, \texttt{coral}, \texttt{salmon}, \texttt{crimson}, \texttt{lavender}, \texttt{indigo}, \texttt{violet}, \texttt{turquoise}, \texttt{tomato}, and more.
292
293A bare color name on the first line sets the background:
294
295\begin{lstlisting}
296"navy"
297(ink "gold")
298(circle 64 64 30)
299; Navy background, gold circle
300\end{lstlisting}
301
302\subsection{System \& Display (9 functions)}
303
304\begin{lstlisting}
305(def w width) ; screen width
306(def h height) ; screen height
307frame ; current frame number
308time ; seconds elapsed
309
310(resolution "half") ; half-resolution
311(resolution 64 64) ; explicit 64x64
312(fps 30) ; set frame rate
313\end{lstlisting}
314
315\subsection{Control Flow (7 functions)}
316
317\begin{lstlisting}
318; Variable definition
319(def x 50)
320(def y (+ 10 (* frame 0.5)))
321
322; Conditional
323(if (> frame 60)
324 (ink "red")
325 (ink "blue"))
326
327; Loop
328(repeat 10 i
329 (circle (* i 12) 64 5))
330
331; Execute once (not every frame)
332(once (wipe "black"))
333
334; Local binding
335(let ((cx 64) (cy 64))
336 (circle cx cy 30))
337\end{lstlisting}
338
339The \texttt{repeat} loop binds its counter variable (\texttt{i} above) from 0 to $n-1$. Nested repeats use different variable names:
340
341\begin{lstlisting}
342(repeat 8 i
343 (repeat 8 j
344 (box (* i 16) (* j 16) 14 14)))
345; 8x8 grid of squares
346\end{lstlisting}
347
348\subsection{Timing}
349
350\kl{}'s timing system uses \emph{inline scheduling} rather than callbacks. Timing expressions wrap code blocks:
351
352\begin{lstlisting}
353; Frame-based timing
354(0 (wipe "black")) ; every frame
355(1 (spin 5)) ; every 2nd frame
356(30f (ink "red")) ; after 30 frames
357
358; Second-based timing
359(1s (wipe "red")) ; after 1 second
360(2.5s (ink "gold")) ; after 2.5 seconds
361(1s! (write "!" 10 10)) ; fire once at 1s
362
363; Repeating intervals
364(0.5s... (spin 45)) ; every 0.5 seconds
365(1s... (scroll 1 0)) ; every second
366\end{lstlisting}
367
368This eliminates the need for \texttt{setTimeout}, \texttt{setInterval}, or animation frame callbacks. Time is a \emph{property of the expression}, not a function called on it.
369
370\subsection{Text (4 functions)}
371
372\begin{lstlisting}
373(write "hello" 10 20) ; text at position
374(write "centered" ; centered text
375 (/ width 2) (/ height 2))
376(type "typed" 10 10) ; typewriter effect
377\end{lstlisting}
378
379\subsection{Input (3 functions)}
380
381\begin{lstlisting}
382; Pen/mouse position and state
383(if pen
384 (circle pen.x pen.y 5))
385
386; Touch input
387(if hand
388 (line hand.x hand.y 64 64))
389\end{lstlisting}
390
391\subsection{Audio (6 functions)}
392
393\begin{lstlisting}
394; Microphone input
395(def vol (mic)) ; amplitude 0-255
396(circle 64 64 vol) ; sound-reactive
397
398; Melody playback
399(melody "C4 E4 G4 C5")
400
401; Overtone harmonics
402(overtone 440 3) ; 3rd harmonic of A4
403\end{lstlisting}
404
405\subsection{3D Graphics (8 functions)}
406
407\begin{lstlisting}
408(cube "mycube") ; create 3D cube
409(form "mycube"
410 (move 0 0 -5) ; position
411 (scale 2) ; size
412 (spin (* frame 0.5) 1 1 0)) ; rotate
413\end{lstlisting}
414
415\subsection{Composition via \texttt{\$}-Codes}
416
417The most distinctive feature of \kl{} is its composition system. Instead of user-defined functions, programs reference other programs by their short code:
418
419\begin{lstlisting}
420; Embed another program as a layer
421($cow) ; execute program "cow"
422($nece 10 20) ; pass parameters
423
424; Multi-layer composition
425(wipe "black")
426($cow) ; background layer
427($faim) ; foreground layer
428
429; Chain multiple programs
430(resolution 64 64)
431($zobi)
432(spin 1)
433($grel)
434\end{lstlisting}
435
436Programs are fetched from MongoDB, cached in RAM and IndexedDB, and content-addressed via SHA-256. The \texttt{\$}-code system replaces user-defined functions, modules, and libraries with a single social mechanism: \emph{find a program someone made, reference it by code, compose with it}.
437
438The most-referenced programs are simple visual primitives that serve as building blocks. The system produces a social dependency graph: program A embeds program B, which embeds program C, up to 7 layers deep in observed usage.
439
440\section{Evaluation Model}
441
442\kl{} re-evaluates its \textbf{entire AST every frame}. There is no retained state beyond explicitly defined variables. The \texttt{frame} and \texttt{time} variables increment automatically. Transformations like \texttt{zoom}, \texttt{scroll}, and \texttt{spin} accumulate in the framebuffer.
443
444This model eliminates the \texttt{setup()}/\texttt{draw()} split familiar from Processing~\citep{reas2007processing}. Every line of a \kl{} program executes every frame. Animation emerges from frame-dependent expressions:
445
446\begin{lstlisting}
447(wipe "black")
448(ink "white")
449; Circle orbits center using sin/cos
450(circle
451 (+ 64 (* 30 (cos (* frame 0.03))))
452 (+ 64 (* 30 (sin (* frame 0.03))))
453 8)
454\end{lstlisting}
455
456\subsection{Deterministic Randomness}
457
458\texttt{random} is seeded from the program's short code. The same program produces identical output on every device, every time. This makes \kl{} programs \emph{reproducible generative art}: the code \emph{is} the artwork, not just the instructions for generating it.
459
460\subsection{Chaos Mode}
461
462Invalid input---gibberish, unbalanced parentheses, random characters---does not produce error messages. Instead, \kl{} detects low recognition ratios ($<30\%$ known words) and high special character ratios ($>50\%$) and renders artistic visual output. The user never sees ``SyntaxError.'' They see colors.
463
464\section{Design by Omission}
465
466\kl{} deliberately lacks:
467
468\begin{itemize}
469 \item \textbf{User-defined functions}: replaced by \texttt{\$}-code composition
470 \item \textbf{Recursion}: prevents infinite loops and stack overflows
471 \item \textbf{File I/O}: the canvas is the only output
472 \item \textbf{Networking}: programs cannot fetch external data
473 \item \textbf{String manipulation}: no \texttt{concat}, \texttt{split}, \texttt{replace}
474 \item \textbf{Error messages}: replaced by chaos mode
475 \item \textbf{Import/require}: replaced by \texttt{\$}-codes
476 \item \textbf{Objects/classes}: data is numbers, strings, and lists
477\end{itemize}
478
479Each omission is a design decision. The absence of user-defined functions forces composition through the social layer. The absence of error messages means beginners never encounter a wall of red text. The absence of networking means every program is self-contained and safe to run.
480
481This follows the principle that a language's constraints define its creative space more than its features~\citep{papert1980mindstorms, compton2015casual}. \kl{} is not a general-purpose language that happens to do art. It is an art language that \emph{cannot} do anything else.
482
483\section{Complete Built-in Index}
484
485\begin{table}[h]
486\small
487\centering
488\begin{tabularx}{\columnwidth}{Xlr}
489\toprule
490\textbf{Category} & \textbf{Count} & \textbf{Core Functions} \\
491\midrule
492Graphics & 9 & wipe, ink, line, box, circle \\
493Transformations & 11 & scroll, zoom, spin, blur, suck \\
494Math & 14 & +, -, *, /, random, sin, cos \\
495Color & 19+ & red, blue, fade, rainbow, zebra \\
496System/Display & 9 & width, height, frame, time \\
497Control Flow & 7 & def, if, repeat, once, let \\
498Text/Output & 4 & write, type, paste, print \\
499Input & 3 & pen, hand, gamepad \\
500Audio & 6 & mic, melody, overtone, sound \\
5013D Graphics & 8 & cube, form, trans, move, scale \\
502Composition & 4 & \$code, layer, bake, embed \\
503Data & 4 & list, get, set, let \\
504\midrule
505\textbf{Total} & \textbf{118} & \\
506\bottomrule
507\end{tabularx}
508\caption{All 118 built-in functions by category.}
509\label{tab:builtins}
510\end{table}
511
512\section{Example: Complete Program}
513
514A complete \kl{} program that draws a sound-reactive particle field with orbital motion:
515
516\begin{lstlisting}
517"black"
518(def vol (+ 5 (* (mic) 0.2)))
519(repeat 50 i
520 (def angle (* i 0.1256))
521 (def r (+ 20 (* vol (sin (+ (* frame 0.02) angle)))))
522 (def cx (+ 64 (* r (cos (+ angle (* frame 0.01))))))
523 (def cy (+ 64 (* r (sin (+ angle (* frame 0.01))))))
524 (ink (+ 100 (* i 3)) 50 (+ 150 (* i 2)))
525 (circle cx cy (+ 1 (random 3))))
526(blur 1)
527(zoom 1.002)
528\end{lstlisting}
529
530This program: sets a black background, reads microphone amplitude, draws 50 particles in orbital paths modulated by sound, colors them with a computed gradient, applies a slight blur, and slowly zooms in. It runs at 60 FPS. It is 12 lines long. It requires no imports, no setup function, no animation loop, and no event listeners.
531
532\vspace{0.5em}
533\noindent\textbf{ORCID:} \href{https://orcid.org/0009-0007-4460-4913}{0009-0007-4460-4913}
534
535\bibliographystyle{plainnat}
536\bibliography{references}
537
538\end{document}