all

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package all provides additional primitives for records, promises, and extended string/character operations.

Records (SRFI-9 style)

  • make-record-type, record-type?, record?, record-type
  • record-constructor, record-predicate
  • record-accessor, record-modifier

Promises (R7RS 4.2.5)

  • make-promise, promise?, force

Extended String Operations

  • string-copy!, string-fill!
  • string-map, string-for-each
  • string-ci=?, string-ci<?, string-ci>?, string-ci<=?, string-ci>=?
  • string-upcase, string-downcase, string-foldcase

Extended Character Operations

  • char-ci=?, char-ci<?, char-ci>?, char-ci<=?, char-ci>=?
  • char-alphabetic?, char-numeric?, char-whitespace?
  • char-upper-case?, char-lower-case?
  • char-upcase, char-downcase, char-foldcase
  • digit-value

Use Extension or AddToRegistry to register all primitives.

Package all provides a convenience extension that includes all standard extensions.

Index

Constants

This section is empty.

Variables

View Source
var AddToRegistry = Builder.AddToRegistry

AddToRegistry registers all standard primitives.

Builder aggregates all extension registration functions.

Extension includes all standard extensions.

View Source
var PrimCharAlphabeticQ = helpers.MakeCharPredicate("char-alphabetic?", unicode.IsLetter)

Character classification predicates — all use MakeCharPredicate factory.

View Source
var PrimCharDowncase = helpers.MakeCharTransform("char-downcase", unicode.ToLower)
View Source
var PrimCharFoldcase = helpers.MakeCharTransform("char-foldcase", simpleCaseFold)
View Source
var PrimCharLowerCaseQ = helpers.MakeCharPredicate("char-lower-case?", unicode.IsLower)
View Source
var PrimCharNumericQ = helpers.MakeCharPredicate("char-numeric?", unicode.IsDigit)
View Source
var PrimCharUpcase = helpers.MakeCharTransform("char-upcase", unicode.ToUpper)

Character case transformation — all use MakeCharTransform factory.

View Source
var PrimCharUpperCaseQ = helpers.MakeCharPredicate("char-upper-case?", unicode.IsUpper)
View Source
var PrimCharWhitespaceQ = helpers.MakeCharPredicate("char-whitespace?", unicode.IsSpace)
View Source
var PrimIsRecord = helpers.MakeTypePredicate(func(o values.Value) bool {
	_, ok := o.(*values.Record)
	return ok
})

PrimIsRecord implements the (record? obj) primitive.

View Source
var PrimIsRecordType = helpers.MakeTypePredicate(func(o values.Value) bool {
	_, ok := o.(*values.RecordType)
	return ok
})

PrimIsRecordType implements the (record-type? obj) primitive.

View Source
var PrimPromiseQ = helpers.MakeTypePredicate(func(o values.Value) bool {
	_, ok := o.(*values.Promise)
	return ok
})

PrimPromiseQ tests if an object is a promise.

View Source
var PrimStringDowncase = makeStringCaser("string-downcase", func() cases.Caser {
	return cases.Lower(language.Und)
})
View Source
var PrimStringFoldcase = makeStringCaser("string-foldcase", func() cases.Caser {
	return cases.Fold()
})
View Source
var PrimStringUpcase = makeStringCaser("string-upcase", func() cases.Caser {
	return cases.Upper(language.Und)
})
View Source
var SafeBuilder = registry.NewRegistryBuilder(
	addRecords,
	addPromises,
	addMoreStrings,
	addMoreChars,
)

SafeBuilder includes only the safe parts of all: records, promises, strings, and characters. It excludes sub-extensions that grant ambient authority (files, system, eval, gointerop, threads).

View Source
var SafeExtension = registry.NewExtension("all-safe", SafeBuilder.AddToRegistry)

SafeExtension includes records, promises, and additional string/character operations without any privileged sub-extensions.

Functions

func PrimDigitValue

func PrimDigitValue(mc *machine.MachineContext) error

PrimDigitValue implements the (digit-value) primitive. R7RS §6.6: Returns the numeric value (0-9) of a character that is a decimal digit according to Unicode, or #f if it is not a decimal digit.

func PrimForce

func PrimForce(mc *machine.MachineContext) error

PrimForce implements the (force) primitive. Forces evaluation of a promise with proper memoization.

R7RS §4.2.5: The first time a promise is forced, its body is evaluated and the result is memoized; on subsequent forces, the memoized result is returned.

func PrimMakeLazyPromise

func PrimMakeLazyPromise(mc *machine.MachineContext) error

PrimMakeLazyPromise implements the (delay-force) primitive. Creates a lazy promise that delays evaluation of a thunk.

func PrimMakePromise

func PrimMakePromise(mc *machine.MachineContext) error

PrimMakePromise implements the (make-promise) primitive. Creates a promise from a value, wrapping it if not already a promise.

func PrimMakeRecordType

func PrimMakeRecordType(mc *machine.MachineContext) error

PrimMakeRecordType implements the (make-record-type name field-names) primitive. Creates a new record type descriptor.

func PrimRecordAccessor

func PrimRecordAccessor(mc *machine.MachineContext) error

PrimRecordAccessor implements the (record-accessor rt field-tag) primitive. Returns an accessor procedure for the specified field.

func PrimRecordConstructor

func PrimRecordConstructor(mc *machine.MachineContext) error

PrimRecordConstructor implements the (record-constructor rt field-tags) primitive. Returns a constructor procedure for the record type.

func PrimRecordModifier

func PrimRecordModifier(mc *machine.MachineContext) error

PrimRecordModifier implements the (record-modifier rt field-tag) primitive. Returns a modifier procedure for the specified field.

func PrimRecordPredicate

func PrimRecordPredicate(mc *machine.MachineContext) error

PrimRecordPredicate implements the (record-predicate rt) primitive. Returns a predicate procedure for the record type.

func PrimRecordType

func PrimRecordType(mc *machine.MachineContext) error

PrimRecordType implements the (record-type record) primitive. Returns the record type of a record instance.

func PrimStringCopyTo

func PrimStringCopyTo(mc *machine.MachineContext) error

PrimStringCopyTo implements the string-copy! primitive. R7RS §6.7: (string-copy! to at from [start [end]])

func PrimStringFill

func PrimStringFill(mc *machine.MachineContext) error

PrimStringFill implements the string-fill! primitive. R7RS §6.7: (string-fill! string fill [start [end]])

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL