Главная / Документация

Документация

Справочник того, что интерпретатор принимает сегодня. Где что-то ещё не реализовано, справочник это говорит, а не опускает.

Читать документацию Исходный код

Этот раздел ещё не переведён на ваш язык и показан по-английски. Переводы приветствуются.

Значения

TypeMeansWritten as
nilThe absence of a value, and the result of a branch with no alternative.nil
booleanTrue or false. Only false is falsey.#t #f
integerA signed 64-bit integer.42 -7
floatA double-precision number.3.14
runeA Unicode code point.\u00e9
stringAn immutable sequence of bytes, written as text."hello"
symbolAn interned name. Evaluating one looks it up.foo bar?
keywordAn interned name that evaluates to itself.:a
pairA cons cell: a value and the rest of the list.(1 2 3) '()
vectorAn immutable indexed sequence.[1 2 3]
tableAn immutable string-keyed map with sorted keys, so output is stable.{:a 1}
arrayA mutable indexed sequence.@[1 2 3]
closureA procedure and the environment it captured.(lambda (x) ...)
primitiveA built-in procedure implemented in V.+ car

Этот раздел ещё не переведён на ваш язык и показан по-английски. Переводы приветствуются.

Базовые формы

FormMeaningDesugars to
ifEvaluate the test, then one branch. With no alternative the result is nil.`if`
defineBind 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!`
lambdaCreate a procedure. fn is a synonym.`lambda`, `fn`
beginEvaluate in order, return the last. The last form keeps its tail position, so tail calls inside a begin are still tail calls.`begin`
letBind 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`
andShort-circuit. Return the first falsey value, or the last value.`and`, `or`
quoteReturn the form itself instead of evaluating it. The apostrophe is shorthand.`quote`

Этот раздел ещё не переведён на ваш язык и показан по-английски. Переводы приветствуются.

Производные формы

FormMeaningDesugars to
whenRun the body only if the test is true, otherwise nil.`if`
unlessRun the body only if the test is false, otherwise nil.`if`
condTry clauses in order and take the first whose test is true. => separates test from body.nested `if`
caseCompare one value against a list of candidates per clause.`cond`
loopA named let: bind the variable, run the body while the test holds, and advance the variable each round.named `let`
dotimesloop with an implicit counter from zero.`loop`

Этот раздел ещё не переведён на ваш язык и показан по-английски. Переводы приветствуются.

Об истинности

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.

Этот раздел ещё не переведён на ваш язык и показан по-английски. Переводы приветствуются.

Примитивы

FormMeaningDesugars to
arithmeticWhole numbers, with promotion when a float is involved.`+` `-` `*` `/` `%`
comparisonReturn #t or #f.`=` `<` `>` `<=` `>=`
logicNegation. and and or are forms, not primitives, because they short-circuit.`not`
listsBuild and take apart cons cells.`car` `cdr` `cons` `list` `null?`
sequencesTake a procedure and a list, and return a new list.`map` `filter` `fold` `apply`
outputWrite to the machine's output buffer, not straight to a terminal, so a host can capture it.`print` `println`

Этот раздел ещё не переведён на ваш язык и показан по-английски. Переводы приветствуются.

Ещё не реализовано

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.