Start / Dokumentation
Dokumentation
Eine Referenz dessen, was der Interpreter heute akzeptiert. Wo etwas noch nicht umgesetzt ist, steht das dort, statt es auszulassen.
Dieser Abschnitt ist noch nicht in Ihre Sprache uebersetzt und wird auf Englisch gezeigt. Uebersetzungen sind willkommen.
Werte
| Type | Means | Written as |
|---|---|---|
| nil | The absence of a value, and the result of a branch with no alternative. | nil |
| boolean | True or false. Only false is falsey. | #t #f |
| integer | A signed 64-bit integer. | 42 -7 |
| float | A double-precision number. | 3.14 |
| rune | A Unicode code point. | \u00e9 |
| string | An immutable sequence of bytes, written as text. | "hello" |
| symbol | An interned name. Evaluating one looks it up. | foo bar? |
| keyword | An interned name that evaluates to itself. | :a |
| pair | A cons cell: a value and the rest of the list. | (1 2 3) '() |
| vector | An immutable indexed sequence. | [1 2 3] |
| table | An immutable string-keyed map with sorted keys, so output is stable. | {:a 1} |
| array | A mutable indexed sequence. | @[1 2 3] |
| closure | A procedure and the environment it captured. | (lambda (x) ...) |
| primitive | A built-in procedure implemented in V. | + car |
Dieser Abschnitt ist noch nicht in Ihre Sprache uebersetzt und wird auf Englisch gezeigt. Uebersetzungen sind willkommen.
Kernformen
| Form | Meaning | Desugars to |
|---|---|---|
| if | Evaluate the test, then one branch. With no alternative the result is nil. | `if` |
| define | Bind a name in the current frame. A list target defines a procedure. | `define` |
| set! | Assign to the frame that owns the binding, so a closure sees the change on its next call. | `set!` |
| lambda | Create a procedure. fn is a synonym. | `lambda`, `fn` |
| begin | Evaluate in order, return the last. The last form keeps its tail position, so tail calls inside a begin are still tail calls. | `begin` |
| let | Bind names and evaluate the body in a new frame. let binds simultaneously, let* in order, letrec with every name visible to every value. | `let`, `let*`, `letrec` |
| and | Short-circuit. Return the first falsey value, or the last value. | `and`, `or` |
| quote | Return the form itself instead of evaluating it. The apostrophe is shorthand. | `quote` |
Dieser Abschnitt ist noch nicht in Ihre Sprache uebersetzt und wird auf Englisch gezeigt. Uebersetzungen sind willkommen.
Abgeleitete Formen
| Form | Meaning | Desugars to |
|---|---|---|
| when | Run the body only if the test is true, otherwise nil. | `if` |
| unless | Run the body only if the test is false, otherwise nil. | `if` |
| cond | Try clauses in order and take the first whose test is true. => separates test from body. | nested `if` |
| case | Compare one value against a list of candidates per clause. | `cond` |
| loop | A named let: bind the variable, run the body while the test holds, and advance the variable each round. | named `let` |
| dotimes | loop with an implicit counter from zero. | `loop` |
Dieser Abschnitt ist noch nicht in Ihre Sprache uebersetzt und wird auf Englisch gezeigt. Uebersetzungen sind willkommen.
Ueber Wahrheit
Only #f is false. The number zero, the empty string, nil, and the empty list are all true. This matches R5RS and Clojure, and deliberately does not match Ruby, JavaScript, or Python.
The rule matters more than it looks. A language that treats 0 as falsey makes every numeric result a potential branch, which is why code in those languages needs explicit nil checks that vlip code does not.
Dieser Abschnitt ist noch nicht in Ihre Sprache uebersetzt und wird auf Englisch gezeigt. Uebersetzungen sind willkommen.
Primitive
| Form | Meaning | Desugars to |
|---|---|---|
| arithmetic | Whole numbers, with promotion when a float is involved. | `+` `-` `*` `/` `%` |
| comparison | Return #t or #f. | `=` `<` `>` `<=` `>=` |
| logic | Negation. and and or are forms, not primitives, because they short-circuit. | `not` |
| lists | Build and take apart cons cells. | `car` `cdr` `cons` `list` `null?` |
| sequences | Take a procedure and a list, and return a new list. | `map` `filter` `fold` `apply` |
| output | Write to the machine's output buffer, not straight to a terminal, so a host can capture it. | `print` `println` |
Dieser Abschnitt ist noch nicht in Ihre Sprache uebersetzt und wird auf Englisch gezeigt. Uebersetzungen sind willkommen.
Noch nicht umgesetzt
let* and rest parameters are written in the examples and do not yet evaluate correctly. Callable keywords do not work either.
The cause of the let* failure is a real design question rather than a typo: [ ] is a vector literal in a value position and a binding group in a form position, and the reader does not yet record which reading applies. It is written up in the roadmap.