Documentation
¶
Overview ¶
Package core provides the essential primitives required for Scheme to function.
This package registers primitives that are always included in any Wile engine:
Primitives ¶
- Type predicates: null?, pair?, number?, string?, symbol?, etc.
- Equality: eq?, eqv?, equal?
- Pairs and lists: cons, car, cdr, list, append, reverse
- Arithmetic: +, -, *, /, comparisons, min, max, gcd, lcm
- Vectors: make-vector, vector-ref, vector-set!, vector->list
- Strings: string-length, string-ref, string-append, string comparisons
- Characters: char->integer, integer->char, char comparisons
- Bytevectors: make-bytevector, bytevector-u8-ref, utf8->string
- Control: apply, call/cc, values, call-with-values
- Syntax: identifier?, syntax->datum, datum->syntax
Bootstrap Macros ¶
The package also defines essential derived forms as syntax-rules macros: and, or, let, let*, letrec, cond, case, when, unless, guard, do, define-record-type, let-values, define-values, map, for-each.
Registration ¶
Use Extension or AddToRegistry to register all core primitives:
reg := registry.NewRegistry() core.AddToRegistry(reg)
Package core provides the core primitives required for Scheme to function. These primitives are always included and cannot be omitted.
Index ¶
- Variables
- func PrimAbortCurrentContinuation(mc machine.CallContext) error
- func PrimAbs(mc machine.CallContext) error
- func PrimAdd(mc machine.CallContext) error
- func PrimAppend(mc machine.CallContext) error
- func PrimApply(cc machine.CallContext) error
- func PrimApropos(mc machine.CallContext) error
- func PrimAssq(mc machine.CallContext) error
- func PrimAssv(mc machine.CallContext) error
- func PrimBoundIdentifierEqualQ(mc machine.CallContext) error
- func PrimBox(mc machine.CallContext) error
- func PrimBytevector(mc machine.CallContext) error
- func PrimBytevectorAppend(mc machine.CallContext) error
- func PrimBytevectorCopy(mc machine.CallContext) error
- func PrimBytevectorCopyBang(mc machine.CallContext) error
- func PrimBytevectorLength(mc machine.CallContext) error
- func PrimBytevectorU8Ref(mc machine.CallContext) error
- func PrimBytevectorU8Set(mc machine.CallContext) error
- func PrimCallCC(cc machine.CallContext) error
- func PrimCallWithComposableContinuation(cc machine.CallContext) error
- func PrimCallWithContinuationBarrier(cc machine.CallContext) error
- func PrimCallWithContinuationPrompt(cc machine.CallContext) error
- func PrimCallWithExit(cc machine.CallContext) error
- func PrimCallWithImmediateContMark(cc machine.CallContext) error
- func PrimCallWithValues(cc machine.CallContext) error
- func PrimCar(mc machine.CallContext) error
- func PrimCdr(mc machine.CallContext) error
- func PrimCharToInteger(mc machine.CallContext) error
- func PrimCons(mc machine.CallContext) error
- func PrimContinuationMarkSetFirst(mc machine.CallContext) error
- func PrimContinuationMarkSetToList(mc machine.CallContext) error
- func PrimContinuationMarkSetToListStar(mc machine.CallContext) error
- func PrimContinuationMarks(mc machine.CallContext) error
- func PrimContinuationPromptAvailableQ(cc machine.CallContext) error
- func PrimCurrentContinuationMarks(cc machine.CallContext) error
- func PrimDatumToSyntax(mc machine.CallContext) error
- func PrimDefaultContinuationPromptTag(mc machine.CallContext) error
- func PrimDiv(mc machine.CallContext) error
- func PrimDocTopic(mc machine.CallContext) error
- func PrimDocTopics(mc machine.CallContext) error
- func PrimDynamicWind(cc machine.CallContext) error
- func PrimEqQ(mc machine.CallContext) error
- func PrimEqualQ(mc machine.CallContext) error
- func PrimEqvQ(mc machine.CallContext) error
- func PrimError(cc machine.CallContext) error
- func PrimErrorObjectIrritants(mc machine.CallContext) error
- func PrimErrorObjectMessage(mc machine.CallContext) error
- func PrimErrorObjectQ(mc machine.CallContext) error
- func PrimEvenQ(mc machine.CallContext) error
- func PrimExact(mc machine.CallContext) error
- func PrimFileErrorQ(mc machine.CallContext) error
- func PrimFreeIdentifierEqualQ(mc machine.CallContext) error
- func PrimGcd(mc machine.CallContext) error
- func PrimGenerateTemporaries(mc machine.CallContext) error
- func PrimHashtableClear(mc machine.CallContext) error
- func PrimHashtableCopy(mc machine.CallContext) error
- func PrimHashtableDelete(mc machine.CallContext) error
- func PrimHashtableKeys(mc machine.CallContext) error
- func PrimHashtableRef(mc machine.CallContext) error
- func PrimHashtableSet(mc machine.CallContext) error
- func PrimHashtableSize(mc machine.CallContext) error
- func PrimHashtableValues(mc machine.CallContext) error
- func PrimIdentifierQ(mc machine.CallContext) error
- func PrimInexact(mc machine.CallContext) error
- func PrimIntegerQ(mc machine.CallContext) error
- func PrimIntegerToChar(mc machine.CallContext) error
- func PrimLcm(mc machine.CallContext) error
- func PrimLength(mc machine.CallContext) error
- func PrimLibraryDescription(mc machine.CallContext) error
- func PrimList(mc machine.CallContext) error
- func PrimListCopy(mc machine.CallContext) error
- func PrimListRef(mc machine.CallContext) error
- func PrimListSet(mc machine.CallContext) error
- func PrimListTail(mc machine.CallContext) error
- func PrimListToString(mc machine.CallContext) error
- func PrimListToVector(mc machine.CallContext) error
- func PrimMakeBytevector(mc machine.CallContext) error
- func PrimMakeContinuationPromptTag(mc machine.CallContext) error
- func PrimMakeHashtable(mc machine.CallContext) error
- func PrimMakeList(mc machine.CallContext) error
- func PrimMakeParameter(cc machine.CallContext) error
- func PrimMakeString(mc machine.CallContext) error
- func PrimMakeVector(mc machine.CallContext) error
- func PrimMax(mc machine.CallContext) error
- func PrimMemq(mc machine.CallContext) error
- func PrimMemv(mc machine.CallContext) error
- func PrimMin(mc machine.CallContext) error
- func PrimModulo(mc machine.CallContext) error
- func PrimMul(mc machine.CallContext) error
- func PrimNullQ(mc machine.CallContext) error
- func PrimNumEq(mc machine.CallContext) error
- func PrimNumGe(mc machine.CallContext) error
- func PrimNumGt(mc machine.CallContext) error
- func PrimNumLe(mc machine.CallContext) error
- func PrimNumLt(mc machine.CallContext) error
- func PrimOddQ(mc machine.CallContext) error
- func PrimOpaqueTag(mc machine.CallContext) error
- func PrimPairQ(mc machine.CallContext) error
- func PrimParameterConvert(cc machine.CallContext) error
- func PrimParameterRawSet(mc machine.CallContext) error
- func PrimProcedureArity(mc machine.CallContext) error
- func PrimProcedureBoundSymbols(mc machine.CallContext) error
- func PrimProcedureDocumentation(mc machine.CallContext) error
- func PrimProcedureName(mc machine.CallContext) error
- func PrimProcedureSourceLocation(mc machine.CallContext) error
- func PrimProcedureType(mc machine.CallContext) error
- func PrimQuotient(mc machine.CallContext) error
- func PrimRaise(cc machine.CallContext) error
- func PrimRaiseContinuable(cc machine.CallContext) error
- func PrimRationalQ(mc machine.CallContext) error
- func PrimReadErrorQ(mc machine.CallContext) error
- func PrimRealQ(mc machine.CallContext) error
- func PrimRemainder(mc machine.CallContext) error
- func PrimReverse(mc machine.CallContext) error
- func PrimSetBox(mc machine.CallContext) error
- func PrimSetCar(mc machine.CallContext) error
- func PrimSetCdr(mc machine.CallContext) error
- func PrimString(mc machine.CallContext) error
- func PrimStringAppend(mc machine.CallContext) error
- func PrimStringCopy(mc machine.CallContext) error
- func PrimStringLength(mc machine.CallContext) error
- func PrimStringRef(mc machine.CallContext) error
- func PrimStringSet(mc machine.CallContext) error
- func PrimStringToList(mc machine.CallContext) error
- func PrimStringToSymbol(mc machine.CallContext) error
- func PrimStringToUtf8(mc machine.CallContext) error
- func PrimStringToVector(mc machine.CallContext) error
- func PrimSub(mc machine.CallContext) error
- func PrimSubstring(mc machine.CallContext) error
- func PrimSymbolToString(mc machine.CallContext) error
- func PrimSyntaxColumn(mc machine.CallContext) error
- func PrimSyntaxLine(mc machine.CallContext) error
- func PrimSyntaxPosition(mc machine.CallContext) error
- func PrimSyntaxSource(mc machine.CallContext) error
- func PrimSyntaxSpan(mc machine.CallContext) error
- func PrimSyntaxToDatum(mc machine.CallContext) error
- func PrimSyntaxToList(mc machine.CallContext) error
- func PrimUnbox(mc machine.CallContext) error
- func PrimUtf8ToString(mc machine.CallContext) error
- func PrimValues(mc machine.CallContext) error
- func PrimVector(mc machine.CallContext) error
- func PrimVectorAppend(mc machine.CallContext) error
- func PrimVectorCopy(mc machine.CallContext) error
- func PrimVectorCopyTo(mc machine.CallContext) error
- func PrimVectorFill(mc machine.CallContext) error
- func PrimVectorLength(mc machine.CallContext) error
- func PrimVectorRef(mc machine.CallContext) error
- func PrimVectorSet(mc machine.CallContext) error
- func PrimVectorToList(mc machine.CallContext) error
- func PrimVectorToString(mc machine.CallContext) error
- func PrimVoidQ(mc machine.CallContext) error
- func PrimWithExceptionHandler(cc machine.CallContext) error
Constants ¶
This section is empty.
Variables ¶
var AddToRegistry = Builder.AddToRegistry
AddToRegistry registers all core primitives.
var BootstrapFS embed.FS
BootstrapFS embeds bootstrap.scm and the files it includes. bootstrap.scm uses (include ...) directives to load bootstrap_macros.scm and bootstrap_procedures.scm. The engine passes this FS to an EmbedFileResolver so the compiler's include form can resolve them.
var Builder = registry.NewRegistryBuilder(
addSpecialForms,
addPredicates,
addEquality,
addPairs,
addLists,
addArithmetic,
addControl,
addReflection,
addVectors,
addStrings,
addCharacters,
addBytevectors,
addSyntax,
addSyntaxLoc,
addParameters,
addPrompts,
addBoxes,
addOpaque,
addHashtables,
addExceptions,
addContMarks,
addBootstrapSources,
)
Builder aggregates all core registration functions.
ADDING A NEW CORE PRIMITIVE requires updates in these locations:
- registry/core/<category>.go — add PrimitiveSpec to the appropriate addXxx function
- registry/core/prim_<category>.go — implement the ForeignFunction
- registry/core/register.go — add addXxx to Builder (only if creating a new category)
- registry/core/prim_<category>_test.go — add table-driven tests
var Extension = registry.NewExtension("core", AddToRegistry)
Extension is the core extension containing required primitives.
var PrimBooleanQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Boolean) return ok })
PrimBooleanQ implements the boolean? predicate.
var PrimBoxQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Box) return ok })
PrimBoxQ implements the box? predicate. Returns #t if the argument is a box, #f otherwise.
var PrimBytevectorQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.ByteVector) return ok })
PrimBytevectorQ implements the bytevector? predicate.
var PrimCharQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Character) return ok })
PrimCharQ implements the char? predicate.
var PrimComplexQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(values.Number) return ok })
PrimComplexQ implements the complex? predicate. In Scheme, all numbers are complex (complex is the top of the numeric tower).
var PrimContinuationMarkSetQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*machine.ContinuationMarkSet) return ok })
PrimContinuationMarkSetQ implements (continuation-mark-set? obj).
var PrimContinuationPromptTagQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*machine.PromptTag) return ok })
PrimContinuationPromptTagQ tests whether a value is a continuation prompt tag.
var PrimContinuationQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*machine.CapturedContinuation) return ok })
PrimContinuationQ implements (continuation? obj).
var PrimExactQ = helpers.MakeNumericPredicate[values.Number]( "exact?", werr.ErrNotANumber, values.Number.IsExact, )
PrimExactQ implements the exact? predicate.
R7RS §6.2.6: Returns #t if the number is exact, #f otherwise.
var PrimHashtableQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Hashtable) return ok })
PrimHashtableQ implements the hashtable? predicate. Returns #t if the argument is a hash table, #f otherwise.
var PrimInexactQ = helpers.MakeNumericPredicate[values.Number]( "inexact?", werr.ErrNotANumber, func(n values.Number) bool { return !n.IsExact() }, )
PrimInexactQ implements the inexact? predicate.
R7RS §6.2.6: Returns #t if the number is inexact, #f otherwise.
var PrimNumberQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(values.Number) return ok })
PrimNumberQ implements the number? predicate.
var PrimOpaqueQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(values.Opaque) return ok })
PrimOpaqueQ implements the opaque? predicate. Returns #t if the argument satisfies the Opaque interface.
var PrimParameterQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*machine.Parameter) return ok })
PrimParameterQ implements the parameter? predicate. Returns #t if the argument is a parameter object.
var PrimProcedureQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(values.Callable) return ok })
PrimProcedureQ implements the procedure? predicate. R7RS §6.1: Returns #t for all callable types — lambdas, case-lambdas, parameter objects (R7RS §4.2.6), and composable continuations.
var PrimStringQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.String) return ok })
PrimStringQ implements the string? predicate.
var PrimSymbolQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Symbol) return ok })
PrimSymbolQ implements the symbol? predicate.
var PrimVectorQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Vector) return ok })
PrimVectorQ implements the vector? predicate.
Functions ¶
func PrimAbortCurrentContinuation ¶
func PrimAbortCurrentContinuation(mc machine.CallContext) error
PrimAbortCurrentContinuation aborts to the nearest prompt with the given tag.
(abort-current-continuation tag v ...)
Returns an ErrPromptAbort that propagates up through Run() to the enclosing call-with-continuation-prompt or RunWithEscapeHandling.
func PrimAbs ¶
func PrimAbs(mc machine.CallContext) error
PrimAbs implements the abs primitive. R7RS §6.2.6: abs is only defined for real numbers.
func PrimAppend ¶
func PrimAppend(mc machine.CallContext) error
PrimAppend implements (append list ...) per R7RS §6.4. Returns a list consisting of the elements of the first list followed by the elements of the other lists. The last argument may be any object. Benchmarked: kept in Go — Scheme impl is 4-9x slower on short lists (benchmark gate: 20% threshold; actual regression was ~363% for Append).
func PrimApply ¶
func PrimApply(cc machine.CallContext) error
PrimApply implements the apply primitive. Applies a procedure to a list of arguments.
func PrimApropos ¶ added in v1.10.3
func PrimApropos(mc machine.CallContext) error
PrimApropos implements (apropos pattern). Returns a sorted list of symbols whose name, doc, or category contains the pattern as a case-insensitive substring. Searches all documentation sources: primitives, binding specs, doc entries, environment bindings, and loaded libraries.
func PrimBoundIdentifierEqualQ ¶
func PrimBoundIdentifierEqualQ(mc machine.CallContext) error
PrimBoundIdentifierEqualQ implements the bound-identifier=? predicate (R7RS). Returns #t if two identifiers have the same name AND the same scope sets, meaning they would create the same binding if used as binding occurrences.
func PrimBox ¶
func PrimBox(mc machine.CallContext) error
PrimBox implements the box primitive. Creates a new box containing the given value.
func PrimBytevector ¶
func PrimBytevector(mc machine.CallContext) error
PrimBytevector implements the bytevector primitive. Creates bytevector from byte arguments.
func PrimBytevectorAppend ¶
func PrimBytevectorAppend(mc machine.CallContext) error
PrimBytevectorAppend implements the bytevector-append primitive. Concatenates bytevectors.
func PrimBytevectorCopy ¶
func PrimBytevectorCopy(mc machine.CallContext) error
PrimBytevectorCopy implements the bytevector-copy primitive. Returns a copy of a bytevector.
func PrimBytevectorCopyBang ¶
func PrimBytevectorCopyBang(mc machine.CallContext) error
PrimBytevectorCopyBang implements the bytevector-copy! primitive. Copies bytes between bytevectors.
func PrimBytevectorLength ¶
func PrimBytevectorLength(mc machine.CallContext) error
PrimBytevectorLength implements the bytevector-length primitive. Returns length of bytevector.
func PrimBytevectorU8Ref ¶
func PrimBytevectorU8Ref(mc machine.CallContext) error
PrimBytevectorU8Ref implements the bytevector-u8-ref primitive. Returns byte at index as an exact integer (R7RS §6.9).
func PrimBytevectorU8Set ¶
func PrimBytevectorU8Set(mc machine.CallContext) error
PrimBytevectorU8Set implements the bytevector-u8-set! primitive. Sets byte at index.
func PrimCallCC ¶
func PrimCallCC(cc machine.CallContext) error
PrimCallCC implements the call/cc primitive. Captures current continuation and passes to procedure.
R7RS §6.10: call-with-current-continuation packages the current continuation as an "escape procedure" and passes it as an argument to proc.
Curry-Howard: call/cc as Peirce's law (Griffin 1990).
call/cc : ((A → B) → A) → A where f : (A → B) → A is the user callback, and the escape continuation k : A → B has return type B (invoking k never returns to f — it aborts to the prompt). Adding call/cc to a language = adding the law of excluded middle. This means certain program transformations (e.g., CPS conversion optimizations that assume intuitionistic control flow) are unsound in the presence of call/cc. Invariant: the escape closure must abort to DefaultPromptTag after applying the captured continuation. Without the abort, control would return to f after k returns, violating the B return type. Constrains: ErrPromptAbort handling (must propagate through foreign calls), RunWithEscapeHandling (top-level abort catcher). Constrained by: CESK model (K must be capturable data, not Go stack), WindingStack (captured by value for dynamic-wind thunks), threadID (cross-thread invocation rejected).
See BIBLIOGRAPHY.md "call/cc as Peirce's Law".
Implementation follows the Racket model: capture a composable continuation (via SliceContinuationAt), build an escape closure that applies it then aborts.
(call/cc f) ≡
(call-with-composable-continuation
(lambda (k)
(f (lambda (v) (abort-current-continuation default-prompt-tag (k v)))))
default-prompt-tag)
Two execution modes:
Inline mode (mc.Parent() != nil): The lambda runs directly in the current VM context. This preserves the full continuation chain, ensuring continuations captured inside the lambda include the complete call stack back to the top level. This is critical for cooperative coroutines and other patterns that capture/invoke multiple continuations.
Sub-context mode (mc.Parent() == nil): Falls back to running the lambda in an isolated sub-context. Used when call/cc is invoked inside another foreign function's sub-context (e.g., inside apply or dynamic-wind) where there's no saved continuation to return to.
func PrimCallWithComposableContinuation ¶
func PrimCallWithComposableContinuation(cc machine.CallContext) error
PrimCallWithComposableContinuation captures a composable (delimited) continuation up to the nearest prompt with the given tag, then invokes proc with that continuation as its argument.
(call-with-composable-continuation proc tag)
The captured continuation is a ComposableContinuation value that, when applied, splices its frames onto the current continuation chain.
Follows Racket's call-with-composable-continuation.
func PrimCallWithContinuationBarrier ¶ added in v1.4.0
func PrimCallWithContinuationBarrier(cc machine.CallContext) error
PrimCallWithContinuationBarrier implements (call-with-continuation-barrier thunk).
Calls thunk with no arguments and returns its result. Establishes a continuation barrier: any attempt to invoke a continuation that would cross the barrier boundary signals an error. Barriers cannot be re-entered — they return exactly once.
Specifically, any call/cc escape closure or composable continuation captured inside the barrier will fail with a barrier violation if invoked from outside the barrier (after the barrier has returned), or from a different barrier context. Similarly, continuations captured outside the barrier cannot be invoked from inside it to jump out.
Exceptions, prompt aborts, and call-with-exit escapes propagate normally through the barrier, since they are upward-only unwinds that do not cross boundaries.
See plans/CALL_WITH_EXIT_AND_WITH_BAFFLE.md for full semantics and test cases.
func PrimCallWithContinuationPrompt ¶
func PrimCallWithContinuationPrompt(cc machine.CallContext) error
PrimCallWithContinuationPrompt installs a continuation prompt and runs the thunk.
(call-with-continuation-prompt thunk tag handler)
The prompt frame is pushed onto the continuation chain. If the thunk aborts to this prompt's tag, the handler is invoked with the abort values. If the thunk returns normally, its value is the result.
Follows Racket's call-with-continuation-prompt.
func PrimCallWithExit ¶ added in v1.4.0
func PrimCallWithExit(cc machine.CallContext) error
PrimCallWithExit implements (call-with-exit proc).
Calls proc with a single-use escape procedure. If the escape procedure is called with a value during proc's dynamic extent, call-with-exit immediately returns that value (after running any dynamic-wind after thunks). If proc returns normally, call-with-exit returns that value and the escape procedure is invalidated.
Unlike call/cc, call-with-exit does NOT capture a reified continuation — the escape procedure is a lightweight one-shot upward escape. Calling the escape after call-with-exit has returned signals an error.
Inspired by S7 Scheme's call-with-exit and Guile's call-with-escape-continuation.
func PrimCallWithImmediateContMark ¶ added in v1.7.0
func PrimCallWithImmediateContMark(cc machine.CallContext) error
PrimCallWithImmediateContMark implements (call-with-immediate-continuation-mark key proc [default]).
Gets the nearest mark for key in the current continuation, then calls proc with that value. If no mark is set, calls proc with default (#f if omitted).
Uses GetImmediateMark, which checks the live frame first, then the saved continuation frame — covering both tail and non-tail compilation contexts. In tail position, with-continuation-mark writes to mc.marks. In non-tail position, SaveContinuation moves mc.marks to mc.cont before the call.
func PrimCallWithValues ¶
func PrimCallWithValues(cc machine.CallContext) error
PrimCallWithValues implements the call-with-values primitive. Calls producer, passes results to consumer.
func PrimCar ¶
func PrimCar(mc machine.CallContext) error
PrimCar implements the car primitive. Returns the first element of a pair.
R7RS §6.4: It is an error to take the car of the empty list.
func PrimCdr ¶
func PrimCdr(mc machine.CallContext) error
PrimCdr implements the cdr primitive. Returns the second element of a pair.
R7RS §6.4: It is an error to take the cdr of the empty list.
func PrimCharToInteger ¶
func PrimCharToInteger(mc machine.CallContext) error
PrimCharToInteger implements the (char->integer) primitive. Returns the Unicode code point of the character as an integer.
func PrimCons ¶
func PrimCons(mc machine.CallContext) error
PrimCons implements the cons primitive. Creates a new pair from the car and cdr arguments.
func PrimContinuationMarkSetFirst ¶ added in v1.7.0
func PrimContinuationMarkSetFirst(mc machine.CallContext) error
PrimContinuationMarkSetFirst implements (continuation-mark-set-first mark-set key [default]). Returns the value for key from the nearest frame, or default (#f if omitted).
func PrimContinuationMarkSetToList ¶ added in v1.7.0
func PrimContinuationMarkSetToList(mc machine.CallContext) error
PrimContinuationMarkSetToList implements (continuation-mark-set->list mark-set key). Extracts a list of values for key across all frames in the mark set.
func PrimContinuationMarkSetToListStar ¶ added in v1.7.0
func PrimContinuationMarkSetToListStar(mc machine.CallContext) error
PrimContinuationMarkSetToListStar implements (continuation-mark-set->list* mark-set key-list [none-v]). Returns a list of vectors, one per frame that has at least one of the keys. Each vector position corresponds to a key in key-list. Missing keys use none-v (default #f).
Racket §10.5: continuation-mark-set->list*
func PrimContinuationMarks ¶ added in v1.7.0
func PrimContinuationMarks(mc machine.CallContext) error
PrimContinuationMarks implements (continuation-marks cont [prompt-tag]). Extracts a ContinuationMarkSet from a captured continuation (the result of call/cc), optionally stopping at prompt-tag.
func PrimContinuationPromptAvailableQ ¶ added in v1.7.0
func PrimContinuationPromptAvailableQ(cc machine.CallContext) error
PrimContinuationPromptAvailableQ tests whether a prompt with the given tag is on the current continuation chain.
(continuation-prompt-available? tag) -> boolean
Walks the continuation chain using FindPrompt, which checks both continuation frames and the context-level prompt.
Racket §10.4: continuation-prompt-available?
func PrimCurrentContinuationMarks ¶ added in v1.7.0
func PrimCurrentContinuationMarks(cc machine.CallContext) error
PrimCurrentContinuationMarks implements (current-continuation-marks [prompt-tag]). Walks the continuation chain and returns a ContinuationMarkSet snapshot.
func PrimDatumToSyntax ¶
func PrimDatumToSyntax(mc machine.CallContext) error
PrimDatumToSyntax implements the datum->syntax procedure (R6RS). Converts a datum to a syntax object using the lexical context from template-id. If template-id is #f, the datum has no lexical context.
(datum->syntax template-id datum) -> syntax-object
func PrimDefaultContinuationPromptTag ¶
func PrimDefaultContinuationPromptTag(mc machine.CallContext) error
PrimDefaultContinuationPromptTag returns the default continuation prompt tag.
func PrimDocTopic ¶ added in v1.10.3
func PrimDocTopic(mc machine.CallContext) error
PrimDocTopic implements (doc-topic category). Returns a sorted list of symbols in the named category.
func PrimDocTopics ¶ added in v1.10.3
func PrimDocTopics(mc machine.CallContext) error
PrimDocTopics implements (doc-topics). Returns a sorted list of category name strings.
func PrimDynamicWind ¶
func PrimDynamicWind(cc machine.CallContext) error
PrimDynamicWind implements the (dynamic-wind) primitive. Calls a thunk with before and after handlers that execute on entry and exit.
R7RS §6.10: dynamic-wind calls thunk without arguments, returning the result(s). Before is called whenever execution enters the dynamic extent of the call to thunk, and after is called whenever it exits.
func PrimEqQ ¶
func PrimEqQ(mc machine.CallContext) error
PrimEqQ implements the eq? predicate (R7RS §6.1). Returns #t if both arguments are identical: pointer equality for most types, string key comparison for symbols (R7RS §6.5).
func PrimEqualQ ¶
func PrimEqualQ(mc machine.CallContext) error
PrimEqualQ implements the equal? predicate for structural equality. Returns #t if both arguments have the same structure and values.
func PrimEqvQ ¶
func PrimEqvQ(mc machine.CallContext) error
PrimEqvQ implements the eqv? predicate (R7RS). Returns #t if both arguments are operationally equivalent: - Same object (pointer equality), OR - Both are numbers of the same type with the same value, OR - Both are characters with the same value Unlike eq?, eqv? treats equivalent numbers/characters as equal even if they are different objects. Unlike equal?, eqv? does not recurse into pairs, vectors, or strings.
func PrimError ¶ added in v1.6.0
func PrimError(cc machine.CallContext) error
PrimError implements the error primitive. (error message irritant ...) Creates an error object with the given message and irritants, then raises it.
func PrimErrorObjectIrritants ¶ added in v1.6.0
func PrimErrorObjectIrritants(mc machine.CallContext) error
PrimErrorObjectIrritants implements the error-object-irritants accessor. Returns the list of irritant objects from an error object.
func PrimErrorObjectMessage ¶ added in v1.6.0
func PrimErrorObjectMessage(mc machine.CallContext) error
PrimErrorObjectMessage implements the error-object-message accessor. Returns the message string from an error object.
func PrimErrorObjectQ ¶ added in v1.6.0
func PrimErrorObjectQ(mc machine.CallContext) error
PrimErrorObjectQ implements the error-object? predicate. Returns #t if the argument is an error object created by (error ...), #f otherwise.
func PrimEvenQ ¶
func PrimEvenQ(mc machine.CallContext) error
PrimEvenQ implements the even? predicate.
R7RS §6.2.6: Returns #t if the integer is even, #f otherwise. Accepts any integer, including inexact integers (e.g., 4.0).
func PrimExact ¶
func PrimExact(mc machine.CallContext) error
PrimExact implements the (exact) primitive. Converts an inexact number to an exact representation.
R7RS §6.2.6: The exact procedure returns an exact representation of z that is numerically closest to the argument.
func PrimFileErrorQ ¶ added in v1.6.0
func PrimFileErrorQ(mc machine.CallContext) error
PrimFileErrorQ implements the file-error? predicate. R7RS §6.11: Returns #t if obj is an error object raised during file operations.
func PrimFreeIdentifierEqualQ ¶
func PrimFreeIdentifierEqualQ(mc machine.CallContext) error
PrimFreeIdentifierEqualQ implements the free-identifier=? predicate (R7RS). Returns #t if two identifiers would resolve to the same binding in the current environment. For unbound identifiers, returns #t if they have the same name.
func PrimGenerateTemporaries ¶
func PrimGenerateTemporaries(mc machine.CallContext) error
PrimGenerateTemporaries implements the generate-temporaries procedure (R6RS). Takes a list (or syntax list) and returns a list of fresh identifiers with the same length. Each identifier is guaranteed to be unique.
(generate-temporaries stx-list) -> list of identifiers
func PrimHashtableClear ¶
func PrimHashtableClear(mc machine.CallContext) error
PrimHashtableClear implements the hashtable-clear! primitive. Removes all entries from the hash table.
func PrimHashtableCopy ¶
func PrimHashtableCopy(mc machine.CallContext) error
PrimHashtableCopy implements the hashtable-copy primitive. Returns a shallow copy of the hash table.
func PrimHashtableDelete ¶
func PrimHashtableDelete(mc machine.CallContext) error
PrimHashtableDelete implements the hashtable-delete! primitive. (hashtable-delete! ht key)
func PrimHashtableKeys ¶
func PrimHashtableKeys(mc machine.CallContext) error
PrimHashtableKeys implements the hashtable-keys primitive. Returns a list of all keys in the hash table.
func PrimHashtableRef ¶
func PrimHashtableRef(mc machine.CallContext) error
PrimHashtableRef implements the hashtable-ref primitive. (hashtable-ref ht key) — errors if key is missing. (hashtable-ref ht key default) — returns default if key is missing.
func PrimHashtableSet ¶
func PrimHashtableSet(mc machine.CallContext) error
PrimHashtableSet implements the hashtable-set! primitive. (hashtable-set! ht key value)
func PrimHashtableSize ¶
func PrimHashtableSize(mc machine.CallContext) error
PrimHashtableSize implements the hashtable-size primitive. Returns the number of entries in the hash table.
func PrimHashtableValues ¶
func PrimHashtableValues(mc machine.CallContext) error
PrimHashtableValues implements the hashtable-values primitive. Returns a list of all values in the hash table.
func PrimIdentifierQ ¶
func PrimIdentifierQ(mc machine.CallContext) error
PrimIdentifierQ implements the identifier? predicate (R6RS). Returns #t if the argument is a syntax object representing an identifier.
func PrimInexact ¶
func PrimInexact(mc machine.CallContext) error
PrimInexact implements the (inexact) primitive. Converts exact number to inexact.
R7RS §6.2.6: The inexact procedure returns an inexact representation of z that is numerically closest to the argument.
func PrimIntegerQ ¶
func PrimIntegerQ(mc machine.CallContext) error
PrimIntegerQ implements the integer? predicate.
R7RS §6.2.6: Returns #t if the argument is an integer (exact or inexact). Inexact integers are floating-point numbers with zero fractional part.
func PrimIntegerToChar ¶
func PrimIntegerToChar(mc machine.CallContext) error
PrimIntegerToChar implements the (integer->char) primitive. Converts a Unicode code point (integer) to a character.
R7RS §6.6: The argument must be a valid Unicode scalar value, i.e., an integer in [0, #xD7FF] ∪ [#xE000, #x10FFFF].
func PrimLength ¶
func PrimLength(mc machine.CallContext) error
PrimLength implements the (length) primitive. Benchmarked: kept in Go — Scheme impl is 9x slower on short lists.
func PrimLibraryDescription ¶ added in v1.10.3
func PrimLibraryDescription(mc machine.CallContext) error
PrimLibraryDescription implements (library-description library-name). Returns the description string of a loaded library, or #f if none or not loaded.
func PrimList ¶
func PrimList(mc machine.CallContext) error
PrimList implements the (list) primitive. Creates a list from the given arguments.
The rest-arg list may be backed by a reusable buffer (restArgBuf), so we must copy the spine to produce a persistent list.
func PrimListCopy ¶
func PrimListCopy(mc machine.CallContext) error
PrimListCopy implements the list-copy primitive. Benchmarked: kept in Go — Scheme impl is 7x slower on short lists.
func PrimListRef ¶
func PrimListRef(mc machine.CallContext) error
PrimListRef implements the (list-ref) primitive. Returns the element at the given index in a list. R7RS §6.4: The index must be an exact non-negative integer.
func PrimListSet ¶
func PrimListSet(mc machine.CallContext) error
PrimListSet implements the Scheme list-set! primitive. R7RS §6.4: The index must be an exact non-negative integer.
func PrimListTail ¶
func PrimListTail(mc machine.CallContext) error
PrimListTail implements the (list-tail) primitive. Benchmarked: kept in Go — Scheme impl is 6x slower on short lists.
func PrimListToString ¶
func PrimListToString(mc machine.CallContext) error
PrimListToString implements the (list->string) primitive. Converts a list of characters to a string.
func PrimListToVector ¶
func PrimListToVector(mc machine.CallContext) error
PrimListToVector implements the list->vector primitive.
func PrimMakeBytevector ¶
func PrimMakeBytevector(mc machine.CallContext) error
PrimMakeBytevector implements the (make-bytevector) primitive. Creates a bytevector of the given size, optionally filled with a specified byte value.
func PrimMakeContinuationPromptTag ¶
func PrimMakeContinuationPromptTag(mc machine.CallContext) error
PrimMakeContinuationPromptTag creates a new continuation prompt tag. With no arguments, creates an anonymous tag. With one argument (a symbol), creates a named tag for debugging purposes.
Follows Racket's make-continuation-prompt-tag.
func PrimMakeHashtable ¶
func PrimMakeHashtable(mc machine.CallContext) error
PrimMakeHashtable implements the make-hashtable primitive. Creates a new empty hash table.
func PrimMakeList ¶
func PrimMakeList(mc machine.CallContext) error
PrimMakeList implements the Scheme make-list primitive.
func PrimMakeParameter ¶
func PrimMakeParameter(cc machine.CallContext) error
PrimMakeParameter implements the (make-parameter) primitive. Creates a parameter object with an initial value and optional converter.
(make-parameter init) ; create with initial value (make-parameter init converter) ; create with converter procedure
If a converter is provided, it is applied to the initial value and to any value passed when setting the parameter.
func PrimMakeString ¶
func PrimMakeString(mc machine.CallContext) error
PrimMakeString implements the make-string primitive. (make-string k) creates a string of k unspecified characters. (make-string k char) creates a string of k copies of char.
func PrimMakeVector ¶
func PrimMakeVector(mc machine.CallContext) error
PrimMakeVector implements the (make-vector) primitive. Creates a vector of the given size, optionally filled with a specified value.
func PrimMemq ¶
func PrimMemq(mc machine.CallContext) error
PrimMemq implements the memq primitive. Finds an element in a list using eq? for comparison.
func PrimMemv ¶
func PrimMemv(mc machine.CallContext) error
PrimMemv implements the memv primitive. Finds an element in a list using eqv? for comparison.
func PrimModulo ¶
func PrimModulo(mc machine.CallContext) error
PrimModulo implements the modulo primitive. Returns the modulo of two integers with the sign of the divisor. Accepts exact and inexact integers per R7RS.
func PrimNullQ ¶
func PrimNullQ(mc machine.CallContext) error
PrimNullQ implements the null? predicate. Returns #t if the argument is the empty list '().
func PrimNumEq ¶
func PrimNumEq(mc machine.CallContext) error
PrimNumEq implements the = primitive.
R7RS §6.2.6: Returns #t if its arguments are numerically equal.
func PrimNumGe ¶
func PrimNumGe(mc machine.CallContext) error
PrimNumGe implements the >= primitive.
R7RS §6.2.6: Returns #t if its arguments are monotonically nonincreasing. IEEE 754: Any comparison with NaN returns #f.
func PrimNumGt ¶
func PrimNumGt(mc machine.CallContext) error
PrimNumGt implements the > primitive.
R7RS §6.2.6: Ordering comparisons require real arguments.
func PrimNumLe ¶
func PrimNumLe(mc machine.CallContext) error
PrimNumLe implements the <= primitive.
R7RS §6.2.6: Returns #t if its arguments are monotonically nondecreasing. IEEE 754: Any comparison with NaN returns #f.
func PrimNumLt ¶
func PrimNumLt(mc machine.CallContext) error
PrimNumLt implements the < primitive.
R7RS §6.2.6: Ordering comparisons require real arguments.
func PrimOddQ ¶
func PrimOddQ(mc machine.CallContext) error
PrimOddQ implements the odd? predicate.
R7RS §6.2.6: Returns #t if the integer is odd, #f otherwise. Accepts any integer, including inexact integers (e.g., 3.0).
func PrimOpaqueTag ¶ added in v1.9.1
func PrimOpaqueTag(mc machine.CallContext) error
PrimOpaqueTag implements the opaque-tag primitive. Returns the tag of an opaque value as a symbol.
func PrimPairQ ¶
func PrimPairQ(mc machine.CallContext) error
PrimPairQ implements the pair? predicate. Returns #t if the argument is a pair (cons cell). EmptyList is not a *Pair (it's a separate type), so the type assertion handles (pair? '()) -> #f at the type level per R7RS §6.4.
func PrimParameterConvert ¶ added in v1.7.0
func PrimParameterConvert(cc machine.CallContext) error
PrimParameterConvert implements (%parameter-convert param val). Applies the parameter's converter to val and returns the result. If the parameter has no converter, returns val unchanged.
Used by the parameterize macro to pre-convert the value before storing it as a continuation mark. This is an internal primitive.
func PrimParameterRawSet ¶ added in v1.5.0
func PrimParameterRawSet(mc machine.CallContext) error
PrimParameterRawSet implements the (%parameter-raw-set! param val) primitive. Sets a parameter's internal value directly, bypassing the converter.
This is an internal primitive — not part of the public API.
func PrimProcedureArity ¶ added in v1.5.0
func PrimProcedureArity(mc machine.CallContext) error
PrimProcedureArity implements (procedure-arity proc).
func PrimProcedureBoundSymbols ¶ added in v1.5.0
func PrimProcedureBoundSymbols(mc machine.CallContext) error
PrimProcedureBoundSymbols implements (procedure-bound-symbols proc).
func PrimProcedureDocumentation ¶ added in v1.10.3
func PrimProcedureDocumentation(mc machine.CallContext) error
PrimProcedureDocumentation implements (procedure-documentation proc). Returns the docstring attached to a procedure, or #f if none. For Scheme closures, the docstring is extracted from the body (Guile convention). For foreign closures, the docstring comes from PrimitiveSpec.Doc.
func PrimProcedureName ¶ added in v1.5.0
func PrimProcedureName(mc machine.CallContext) error
PrimProcedureName implements (procedure-name proc).
func PrimProcedureSourceLocation ¶ added in v1.5.0
func PrimProcedureSourceLocation(mc machine.CallContext) error
PrimProcedureSourceLocation implements (procedure-source-location proc).
func PrimProcedureType ¶ added in v1.5.0
func PrimProcedureType(mc machine.CallContext) error
PrimProcedureType implements (procedure-type proc).
func PrimQuotient ¶
func PrimQuotient(mc machine.CallContext) error
PrimQuotient implements the (quotient) primitive. Returns truncated integer quotient. Accepts exact and inexact integers per R7RS.
func PrimRaise ¶ added in v1.6.0
func PrimRaise(cc machine.CallContext) error
PrimRaise implements the raise primitive. (raise obj) Raises a non-continuable exception with obj as the condition.
func PrimRaiseContinuable ¶ added in v1.6.0
func PrimRaiseContinuable(cc machine.CallContext) error
PrimRaiseContinuable implements the raise-continuable primitive. (raise-continuable obj) Raises a continuable exception with obj as the condition. If the handler returns, its return value becomes the value of raise-continuable, and execution continues from the call site per R7RS §6.11.
func PrimRationalQ ¶
func PrimRationalQ(mc machine.CallContext) error
PrimRationalQ implements the rational? predicate.
R7RS §6.2.6: Returns #t if the argument is a rational number. Integers (including BigInteger) are a subset of rationals.
func PrimReadErrorQ ¶ added in v1.6.0
func PrimReadErrorQ(mc machine.CallContext) error
PrimReadErrorQ implements the read-error? predicate. R7RS §6.11: Returns #t if obj is an error object raised during reading.
func PrimRealQ ¶
func PrimRealQ(mc machine.CallContext) error
PrimRealQ implements the real? predicate.
R7RS §6.2.6: Returns #t if the argument is a real number. Rationals (including integers and BigInteger) are a subset of reals.
func PrimRemainder ¶
func PrimRemainder(mc machine.CallContext) error
PrimRemainder implements the (remainder) primitive. Returns remainder with sign of dividend. Accepts exact and inexact integers per R7RS.
func PrimReverse ¶
func PrimReverse(mc machine.CallContext) error
PrimReverse implements the (reverse) primitive. Benchmarked: kept in Go — Scheme impl is 7x slower on short lists.
func PrimSetBox ¶
func PrimSetBox(mc machine.CallContext) error
PrimSetBox implements the set-box! primitive. Sets the value contained in a box.
func PrimSetCar ¶
func PrimSetCar(mc machine.CallContext) error
PrimSetCar implements the set-car! primitive.
func PrimSetCdr ¶
func PrimSetCdr(mc machine.CallContext) error
PrimSetCdr implements the set-cdr! primitive.
func PrimString ¶
func PrimString(mc machine.CallContext) error
PrimString implements the string primitive. (string char ...) returns a newly allocated string composed of the given characters.
func PrimStringAppend ¶
func PrimStringAppend(mc machine.CallContext) error
PrimStringAppend implements the (string-append) primitive. Concatenates strings.
func PrimStringCopy ¶
func PrimStringCopy(mc machine.CallContext) error
PrimStringCopy implements the string-copy primitive. R7RS §6.7: (string-copy string [start [end]]) Returns a newly allocated copy of the given string (or substring). The returned string is mutable and distinct from the original.
func PrimStringLength ¶
func PrimStringLength(mc machine.CallContext) error
PrimStringLength implements string-length. Returns the number of characters (runes) in the string.
func PrimStringRef ¶
func PrimStringRef(mc machine.CallContext) error
PrimStringRef implements the string-ref primitive. Returns the character at the given index in the string.
func PrimStringSet ¶
func PrimStringSet(mc machine.CallContext) error
PrimStringSet implements the string-set! primitive. Stores char in element k of string. R7RS §6.7: (string-set! string k char)
func PrimStringToList ¶
func PrimStringToList(mc machine.CallContext) error
PrimStringToList implements the string->list primitive. R7RS §6.7: (string->list string [start [end]]) Converts a string (or substring) to a list of characters.
func PrimStringToSymbol ¶
func PrimStringToSymbol(mc machine.CallContext) error
PrimStringToSymbol implements the string->symbol primitive. Converts a string to a symbol.
func PrimStringToUtf8 ¶
func PrimStringToUtf8(mc machine.CallContext) error
PrimStringToUtf8 implements the string->utf8 primitive. Converts a string to a UTF-8 encoded bytevector with optional start and end indices.
R7RS §6.9: (string->utf8 string [start [end]]) Returns a newly allocated bytevector containing the UTF-8 encoding of the characters in string between start and end (character positions, not byte positions).
func PrimStringToVector ¶
func PrimStringToVector(mc machine.CallContext) error
PrimStringToVector implements the string->vector primitive. R7RS §6.8: (string->vector string [start [end]]) Returns a vector containing the characters of string between start and end.
func PrimSubstring ¶
func PrimSubstring(mc machine.CallContext) error
PrimSubstring implements the substring primitive. Returns a substring between the given start and end indices.
func PrimSymbolToString ¶
func PrimSymbolToString(mc machine.CallContext) error
PrimSymbolToString implements the symbol->string primitive. Converts a symbol to an immutable string. R7RS §6.5: The string returned by symbol->string is immutable.
func PrimSyntaxColumn ¶ added in v1.7.0
func PrimSyntaxColumn(mc machine.CallContext) error
PrimSyntaxColumn returns the 0-based column of a syntax object, or #f.
Racket §12.2: syntax-column
func PrimSyntaxLine ¶ added in v1.7.0
func PrimSyntaxLine(mc machine.CallContext) error
PrimSyntaxLine returns the 1-based line number of a syntax object, or #f.
Racket §12.2: syntax-line
func PrimSyntaxPosition ¶ added in v1.7.0
func PrimSyntaxPosition(mc machine.CallContext) error
PrimSyntaxPosition returns the 0-based byte position of a syntax object, or #f.
Racket §12.2: syntax-position
func PrimSyntaxSource ¶ added in v1.7.0
func PrimSyntaxSource(mc machine.CallContext) error
PrimSyntaxSource returns the source file path of a syntax object, or #f if the syntax object has no source location.
Racket §12.2: syntax-source
func PrimSyntaxSpan ¶ added in v1.7.0
func PrimSyntaxSpan(mc machine.CallContext) error
PrimSyntaxSpan returns the byte span (end - start) of a syntax object, or #f.
Racket §12.2: syntax-span
func PrimSyntaxToDatum ¶
func PrimSyntaxToDatum(mc machine.CallContext) error
PrimSyntaxToDatum implements the syntax->datum procedure (R6RS). Recursively unwraps a syntax object to its underlying datum, stripping all lexical context information.
func PrimSyntaxToList ¶ added in v1.7.0
func PrimSyntaxToList(mc machine.CallContext) error
PrimSyntaxToList converts a syntax pair chain to a list of syntax objects. Returns #f if the argument is a syntax object but not a proper syntax list. Raises an error if the argument is not a syntax object at all.
Racket §12.2: syntax->list
func PrimUnbox ¶
func PrimUnbox(mc machine.CallContext) error
PrimUnbox implements the unbox primitive. Returns the value contained in a box.
func PrimUtf8ToString ¶
func PrimUtf8ToString(mc machine.CallContext) error
PrimUtf8ToString implements the utf8->string primitive. Converts a UTF-8 encoded bytevector to a string with optional start and end indices.
R7RS §6.9: (utf8->string bytevector [start [end]]) Decodes the bytes of a bytevector between start and end (byte positions) and returns the corresponding string.
func PrimValues ¶
func PrimValues(mc machine.CallContext) error
PrimValues implements the values primitive. Returns multiple values as specified by R7RS. With no arguments returns no values. With one or more arguments, returns all arguments as multiple values.
func PrimVector ¶
func PrimVector(mc machine.CallContext) error
PrimVector implements the vector primitive.
func PrimVectorAppend ¶
func PrimVectorAppend(mc machine.CallContext) error
PrimVectorAppend implements the vector-append primitive. R7RS §6.8: (vector-append vector ...) Returns a newly allocated vector whose elements are the concatenation of the elements of the given vectors.
func PrimVectorCopy ¶
func PrimVectorCopy(mc machine.CallContext) error
PrimVectorCopy implements the vector-copy primitive. R7RS §6.8: (vector-copy vector [start [end]]) Returns a newly allocated copy of the elements of vector between start and end.
func PrimVectorCopyTo ¶
func PrimVectorCopyTo(mc machine.CallContext) error
PrimVectorCopyTo implements the vector-copy! primitive. R7RS §6.8: (vector-copy! to at from [start [end]]) Copies elements from vector from to vector to, starting at index at in to.
func PrimVectorFill ¶
func PrimVectorFill(mc machine.CallContext) error
PrimVectorFill implements the vector-fill! primitive. R7RS §6.8: (vector-fill! vector fill [start [end]]) Sets the elements of vector between start and end to fill.
func PrimVectorLength ¶
func PrimVectorLength(mc machine.CallContext) error
PrimVectorLength implements the vector-length primitive. Returns the number of elements in a vector as an integer.
func PrimVectorRef ¶
func PrimVectorRef(mc machine.CallContext) error
PrimVectorRef implements the vector-ref primitive. Returns the element of a vector at the given index. R7RS §6.8: The index must be an exact non-negative integer.
func PrimVectorSet ¶
func PrimVectorSet(mc machine.CallContext) error
PrimVectorSet implements the vector-set! primitive. Sets the element of a vector at the given index to a new value. R7RS §6.8: The index must be an exact non-negative integer.
func PrimVectorToList ¶
func PrimVectorToList(mc machine.CallContext) error
PrimVectorToList implements the vector->list primitive. R7RS §6.8: (vector->list vector [start [end]]) Converts a vector (or subvector) to a list with the same elements in the same order.
func PrimVectorToString ¶
func PrimVectorToString(mc machine.CallContext) error
PrimVectorToString implements the vector->string primitive. R7RS §6.8: (vector->string vector [start [end]]) Returns a string constructed from the characters in vector between start and end.
func PrimVoidQ ¶
func PrimVoidQ(mc machine.CallContext) error
PrimVoidQ implements the void? predicate. Returns #t if the argument is the void value.
func PrimWithExceptionHandler ¶ added in v1.6.0
func PrimWithExceptionHandler(cc machine.CallContext) error
PrimWithExceptionHandler implements the with-exception-handler primitive. (with-exception-handler handler thunk) Installs handler as exception handler during thunk execution.
Types ¶
This section is empty.
Source Files
¶
- arithmetic.go
- bootstrap.go
- boxes.go
- byte_vectors.go
- characters.go
- cont_marks.go
- control.go
- doc.go
- equality.go
- exceptions.go
- hashtables.go
- lists.go
- opaque.go
- pairs.go
- parameters.go
- predicates.go
- prim_arithmetic.go
- prim_barrier.go
- prim_boxes.go
- prim_byte_vectors.go
- prim_characters.go
- prim_cont_marks.go
- prim_control.go
- prim_equality.go
- prim_exceptions.go
- prim_exit.go
- prim_hashtables.go
- prim_lists.go
- prim_opaque.go
- prim_pairs.go
- prim_parameters.go
- prim_predicates.go
- prim_prompt.go
- prim_reflection.go
- prim_strings.go
- prim_syntax.go
- prim_syntax_loc.go
- prim_vectors.go
- prompts.go
- reflection.go
- register.go
- specialforms.go
- strings.go
- syntax.go
- syntax_loc.go
- vectors.go