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 ¶
- Variables
- func PrimDigitValue(mc machine.CallContext) error
- func PrimForce(cc machine.CallContext) error
- func PrimMakeLazyPromise(mc machine.CallContext) error
- func PrimMakePromise(mc machine.CallContext) error
- func PrimMakeRecordType(mc machine.CallContext) error
- func PrimRecordAccessor(mc machine.CallContext) error
- func PrimRecordConstructor(mc machine.CallContext) error
- func PrimRecordModifier(mc machine.CallContext) error
- func PrimRecordPredicate(mc machine.CallContext) error
- func PrimRecordType(mc machine.CallContext) error
- func PrimStringCopyTo(mc machine.CallContext) error
- func PrimStringFill(mc machine.CallContext) error
Constants ¶
This section is empty.
Variables ¶
var AddToRegistry = Builder.AddToRegistry
AddToRegistry registers all standard primitives.
var Builder = registry.NewRegistryBuilder( io.AddToRegistry, files.AddToRegistry, system.AddToRegistry, math.AddToRegistry, eval.AddToRegistry, nsext.AddToRegistry, threads.AddToRegistry, gointerop.AddToRegistry, process.AddToRegistry, addRecords, addPromises, addMoreStrings, addMoreChars, )
Builder aggregates all extension registration functions.
var Extension = registry.NewDescribedExtension("all", "All Wile extensions combined.", SafeBuilder.AddToRegistry)
Extension registers the primitives defined in this package (records, promises, strings, characters) under the name "all". When used in AllExtensions() where sub-extensions are listed individually, this avoids double-registration. Use Builder.AddToRegistry for standalone use that includes all sub-extensions.
var PrimCharAlphabeticQ = helpers.MakeCharPredicate("char-alphabetic?", unicode.IsLetter)
Character classification predicates — all use MakeCharPredicate factory.
var PrimCharDowncase = helpers.MakeCharTransform("char-downcase", unicode.ToLower)
var PrimCharFoldcase = helpers.MakeCharTransform("char-foldcase", simpleCaseFold)
var PrimCharLowerCaseQ = helpers.MakeCharPredicate("char-lower-case?", unicode.IsLower)
var PrimCharNumericQ = helpers.MakeCharPredicate("char-numeric?", unicode.IsDigit)
var PrimCharUpcase = helpers.MakeCharTransform("char-upcase", unicode.ToUpper)
Character case transformation — all use MakeCharTransform factory.
var PrimCharUpperCaseQ = helpers.MakeCharPredicate("char-upper-case?", unicode.IsUpper)
var PrimCharWhitespaceQ = helpers.MakeCharPredicate("char-whitespace?", unicode.IsSpace)
var PrimIsRecord = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Record) return ok })
PrimIsRecord implements the (record? obj) primitive.
var PrimIsRecordType = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.RecordType) return ok })
PrimIsRecordType implements the (record-type? obj) primitive.
var PrimPromiseQ = helpers.MakeTypePredicate(func(o values.Value) bool { _, ok := o.(*values.Promise) return ok })
PrimPromiseQ tests if an object is a promise.
var PrimStringDowncase = makeStringCaser("string-downcase", func() cases.Caser { return cases.Lower(language.Und) })
var PrimStringFoldcase = makeStringCaser("string-foldcase", func() cases.Caser { return cases.Fold() })
var PrimStringUpcase = makeStringCaser("string-upcase", func() cases.Caser { return cases.Upper(language.Und) })
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, process).
var SafeExtension = registry.NewDescribedExtension("all-safe", "Safe subset: records, promises, strings, characters (no filesystem, eval, or system).", SafeBuilder.AddToRegistry)
SafeExtension includes records, promises, and additional string/character operations without any privileged sub-extensions.
Functions ¶
func PrimDigitValue ¶
func PrimDigitValue(mc machine.CallContext) 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(cc machine.CallContext) 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.CallContext) error
PrimMakeLazyPromise implements the (delay-force) primitive. Creates a lazy promise that delays evaluation of a thunk.
func PrimMakePromise ¶
func PrimMakePromise(mc machine.CallContext) 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.CallContext) error
PrimMakeRecordType implements the (make-record-type name field-names) primitive. Creates a new record type descriptor.
func PrimRecordAccessor ¶
func PrimRecordAccessor(mc machine.CallContext) error
PrimRecordAccessor implements the (record-accessor rt field-tag) primitive. Returns an accessor procedure for the specified field.
func PrimRecordConstructor ¶
func PrimRecordConstructor(mc machine.CallContext) error
PrimRecordConstructor implements the (record-constructor rt field-tags) primitive. Returns a constructor procedure for the record type.
func PrimRecordModifier ¶
func PrimRecordModifier(mc machine.CallContext) error
PrimRecordModifier implements the (record-modifier rt field-tag) primitive. Returns a modifier procedure for the specified field.
func PrimRecordPredicate ¶
func PrimRecordPredicate(mc machine.CallContext) error
PrimRecordPredicate implements the (record-predicate rt) primitive. Returns a predicate procedure for the record type.
func PrimRecordType ¶
func PrimRecordType(mc machine.CallContext) error
PrimRecordType implements the (record-type record) primitive. Returns the record type of a record instance.
func PrimStringCopyTo ¶
func PrimStringCopyTo(mc machine.CallContext) error
PrimStringCopyTo implements the string-copy! primitive. R7RS §6.7: (string-copy! to at from [start [end]])
func PrimStringFill ¶
func PrimStringFill(mc machine.CallContext) error
PrimStringFill implements the string-fill! primitive. R7RS §6.7: (string-fill! string fill [start [end]])
Types ¶
This section is empty.