▼
Output
Quick Reference
| Form | Does |
|---|---|
(eval x) | evaluate x (e.g. after quote) |
(quote x) / 'x | return x unevaluated, as-is |
(cons x y) | construct pair (x . y) |
(car p) | first element of pair/list p |
(cdr p) | rest of list p |
(truncate n) | integer part of n |
(< n1 n2) | #t if n1 < n2, else () |
(> n1 n2) | #t if n1 > n2, else () |
(consp x) | #t if x is a non-empty list, cons, or closure |
(or x1 x2 ...) | first x that is not (), else () |
(and x1 x2 ...) | last x if all are not (), else () |
(not x) | #t if x is (), else () |
(cond (x1 y1) (x2 y2) ...) | the first yi whose xi is non-() |
(if x y z) | y if x is non-(), else z |
(let* (v1 x1) (v2 x2) ... y) | sequentially bind v1..vk, then evaluate y |
(lambda v x) | construct an anonymous closure |
(define v x) | bind v to x, globally |
(defparameter v x) / (defvar v x) | bind v to x, globally (CL style) |
(defun name (args) body) | define a named function, globally |
(setq v x) | update an existing binding in place |
(progn x1 x2 ... xk) | evaluate in order, return the last |
(print x1 x2 ...) | print each value to the Output pane, return the last |
#t | true |
() | empty list / false |
"..." | string literal |
[1 2 3], [[1 2] [3 4]] | tensor literal, any rank |
(+ ..) (- ..) (* ..) (/ ..) | arithmetic; elementwise over tensors |
(sqrt x) (exp x) (log x) (tanh x) (sin x) (cos x) (abs x) | elementwise math; scalar or tensor |
(pow t p) | elementwise power |
(normalize v) | unit vector |
(zero n) | rank-1 tensor of n zeros |
(dot v1 v2) | dot product |
(norm v) / (norm2 v) | length / length² |
(dist v1 v2) / (dist2 v1 v2) | distance / distance² |
(length lst) | number of elements in a plain Lisp list |
(shape t) | tensor of dimension sizes |
(rank t) | number of dimensions (0 for scalars) |
(tensorp x) | #t if x is a tensor |
(slice t i) | element or row at index i |
(first t) / (rest t) | first row / all rows after the first |
(slice-range t start end) | rows/elements in [start, end) |
(col-slice M j) | column j of a matrix, as a vector |
(reshape t [d0 d1 ...]) | reshape, same element count |
(matmul A B) / (@ A B) | matrix product |
(transpose M) / (T M) | swap rows and columns |
(vstack A B) | stack A on top of B, row-wise |
(sum t) | sum of all elements |
(amax t) | maximum element |
(argmax t) | index of the maximum element |
(softmax t) | softmax; row-wise if rank 2 |
(layer-norm t eps) | layer normalization; row-wise if rank 2 |
(causal-mask n) | n×n lower-triangular attention mask |
(equalp v1 v2) | #t if same shape and elementwise equal |
(make-tensor e1 e2 ...) | backend for [ ] literals; rarely called directly |
(point x y) | draw a single point |
(line x0 y0 x1 y1) | draw a line |
(circle x0 y0 r) | draw a circle |
(color r g b) | set the drawing color |
(background r g b) | set the clear color |
(clear) | fill the canvas with the background color |
(axes) / (axes tick-spacing) | draw X/Y axis lines, ticks, numeric labels, and X/Y letters |
(set-origin 'graph) | (0,0) at canvas center, Y up, X/Y can go negative |
(set-origin 'image) | (0,0) at top-left, Y down, X/Y stay non-negative |
dt | real seconds since the previous frame |
⏱️ | dt accumulated since page load — total elapsed seconds |