#core

    Core runtime data types and Unicode utilities used across the interpreter.

    #Highlights

    • Datum, Value, and Primitive definitions
    • Runtime type records and continuations
    • Unicode category and normalization helpers

    #Examples

    ///|
    let folded = UnicodeString::new("StraSSE").foldcase().into_string()

    ///|
    let nfc = UnicodeString::new("e\u{301}").normalize_nfc().into_string()

    ///|
    test "unicode helpers" {
    inspect(UnicodeChar::new('A').general_category(), content="Lu")
    inspect(UnicodeChar::new('A').is_uppercase(), content="true")
    inspect(UnicodeString::new("ABC").foldcase().into_string(), content="abc")
    inspect(UnicodeString::new("AbC").downcase().into_string(), content="abc")
    inspect(UnicodeString::new("abc").upcase().into_string(), content="ABC")
    inspect(
    UnicodeString::new("e\u{301}").normalize_nfc().into_string(),
    content="\u{00e9}",
    )
    inspect(
    UnicodeString::new("\u{00e9}").normalize_nfd().into_string(),
    content="e\u{301}",
    )
    inspect(
    UnicodeString::new("e\u{301}").normalize_nfc().foldcase().into_string(),
    content="\u{00e9}",
    )
    inspect(
    UnicodeString::new("e\u{301}").normalize_nfkd().into_string(),
    content="e\u{301}",
    )
    inspect(
    UnicodeString::new("\u{212b}").normalize_nfkc().into_string(),
    content="\u{00c5}",
    )
    inspect(UnicodeString::new("Hi").into_string(), content="Hi")
    }

    ///|
    test "unicode empty normalization" {
    inspect(UnicodeString::new("").normalize_nfkc().into_string(), content="")
    }

    ///|
    test "unicode char case" {
    inspect(UnicodeChar::new('a').is_lowercase(), content="true")
    inspect(UnicodeChar::new('0').is_alphabetic(), content="false")
    match UnicodeChar::new('a').upcase() {
    'A' => ()
    _ => fail("expected A")
    }
    match UnicodeChar::new('A').downcase() {
    'a' => ()
    _ => fail("expected a")
    }
    }

    ///|
    test "unicode titlecase" {
    match UnicodeChar::new('\u{01C5}').general_category() {
    "Lt" => ()
    _ => fail("expected titlecase category")
    }
    match UnicodeChar::new('\u{01C5}').upcase() {
    '\u{01C4}' | '\u{01C5}' => ()
    _ => fail("expected titlecase upcase")
    }
    match UnicodeChar::new('\u{01C5}').downcase() {
    '\u{01C6}' | '\u{01C5}' => ()
    _ => fail("expected titlecase downcase")
    }
    match UnicodeChar::new('1').downcase() {
    '1' => ()
    _ => fail("expected unchanged")
    }
    }

    ///|
    test "unicode hangul normalization" {
    inspect(
    UnicodeString::new("\u{AC01}").normalize_nfd().into_string(),
    content="\u{1100}\u{1161}\u{11A8}",
    )
    inspect(
    UnicodeString::new("\u{1100}\u{1161}\u{11A8}").normalize_nfc().into_string(),
    content="\u{AC01}",
    )
    inspect(
    UnicodeString::new("\u{0301}A").normalize_nfd().into_string(),
    content="\u{0301}A",
    )
    inspect(
    UnicodeString::new("B\u{0301}").normalize_nfc().into_string(),
    content="B\u{0301}",
    )
    inspect(
    UnicodeString::new("\u{212B}").normalize_nfkd().into_string(),
    content="A\u{030A}",
    )
    inspect(
    UnicodeString::new("\u{2460}").normalize_nfkd().into_string(),
    content="1",
    )
    }

    ///|
    test "binding helpers" {
    let binding = Binding::new(1, Void)
    inspect(binding.id(), content="1")
    match binding.value() {
    Void => ()
    _ => fail("expected void")
    }
    }

    ///|
    test "record field binding helpers" {
    let binding = RecordFieldBinding::new("get", 0, None)
    inspect(binding.accessor(), content="get")
    inspect(binding.index(), content="0")
    debug_inspect(binding.mutator(), content="None")
    }

    ///|
    test "datum constructors" {
    match Datum::Int(42) {
    Int(42) => ()
    _ => fail("expected int datum")
    }
    let pair = Datum::Pair(Ref(Symbol("a")), Ref(Nil))
    match pair {
    Pair(car, cdr) =>
    match (car.val, cdr.val) {
    (Symbol("a"), Nil) => ()
    _ => fail("expected (a)")
    }
    _ => fail("expected pair")
    }
    }

    Env

    type Env = Array[Map[String, Binding]]

    An Array is a collection of values that supports random access and can grow in size.

    EvalError

    pub(all) suberror EvalError {
    EvalError(String)
    } derive(Eq,
    Debug
    )

    impl Show for EvalError

    EvalError::equal

    fn EvalError::equal(EvalError, EvalError) -> Bool

    EvalError::not_equal

    fn EvalError::not_equal(x : EvalError, y : EvalError) -> Bool

    EvalError::output

    fn EvalError::output(self : EvalError, logger : &Logger) -> Unit

    EvalError::to_string

    fn EvalError::to_string(self : EvalError) -> String

    ParseError

    pub(all) suberror ParseError {
    ParseError(String)
    } derive(Eq,
    Debug
    )

    impl Show for ParseError

    ParseError::equal

    fn ParseError::equal(ParseError, ParseError) -> Bool

    ParseError::not_equal

    fn ParseError::not_equal(x : ParseError, y : ParseError) -> Bool

    ParseError::output

    fn ParseError::output(self : ParseError, logger : &Logger) -> Unit

    ParseError::to_string

    fn ParseError::to_string(self : ParseError) -> String

    Binding

    pub struct Binding {
    id : Int
    value : Value
    }

    Binding::id

    fn Binding::id(self : Binding) -> Int

    Read the binding id.

    Example

    test "Binding::id" {
    let binding = Binding::new(7, Void)
    inspect(binding.id(), content="7")
    }

    Binding::new

    fn Binding::new(id : Int, value : Value) -> Binding

    Create a binding value with an id and value.

    Example

    test "Binding::new" {
    let binding = Binding::new(1, Void)
    inspect(binding.id(), content="1")
    }

    Binding::value

    fn Binding::value(self : Binding) -> Value

    Read the binding value.

    Example

    test "Binding::value" {
    let binding = Binding::new(1, Void)
    match binding.value() {
    Void => ()
    _ => fail("expected void")
    }
    }

    CaseClause

    pub struct CaseClause {
    params : Array[String]
    rest : String?
    body : Array[Datum]
    }

    CaseClause::new

    fn CaseClause::new(params : Array[String], rest : String?, body : Array[Datum]) -> CaseClause

    CaseClosure

    pub struct CaseClosure {
    id : Int
    clauses : Array[CaseClause]
    env : Array[Map[String, Binding]]
    }

    CaseClosure::new

    fn CaseClosure::new(id : Int, clauses : Array[CaseClause], env : Array[Map[String, Binding]]) -> CaseClosure

    Closure

    pub struct Closure {
    id : Int
    params : Array[String]
    rest : String?
    body : Array[Datum]
    env : Array[Map[String, Binding]]
    }

    Closure::new

    fn Closure::new(id : Int, params : Array[String], rest : String?, body : Array[Datum], env : Array[Map[String, Binding]]) -> Closure

    Condition

    pub struct Condition {
    id : Int
    components : Array[Record]
    }

    Condition value containing record components.

    Condition::new

    fn Condition::new(id : Int, components : Array[Record]) -> Condition

    ConditionProc

    pub struct ConditionProc {
    id : Int
    kind : ConditionProcKind
    }

    Condition-related procedure wrapper.

    ConditionProc::new

    fn ConditionProc::new(id : Int, kind : ConditionProcKind) -> ConditionProc

    ConditionProcKind

    pub(all) enum ConditionProcKind {
    Predicate(RecordType)
    Accessor(RecordType, Int)
    }

    Continuation

    pub struct Continuation {
    id : Int
    kont : Kont
    handlers : Array[Value]
    winds : Array[Winder]
    }

    First-class continuation value.

    Continuation::new

    fn Continuation::new(id : Int, kont : Kont, handlers : Array[Value], winds : Array[Winder]) -> Continuation

    Datum

    pub(all) enum Datum {
    Nil
    Bool(Bool)
    Int(Int)
    BigInt(
    BigInt
    )
    Rat(Int, Int)
    BigRat(
    BigInt
    ,
    BigInt
    )
    Float(Float)
    Complex(
    Ref
    [Datum],
    Ref
    [Datum])
    Label(Int,
    Ref
    [Datum])
    Char(Char)
    String(
    Ref
    [String])
    Symbol(String)
    Pair(
    Ref
    [Datum],
    Ref
    [Datum])
    Vector(Array[Datum])
    ByteVector(Array[Int])
    Record(Record)
    Condition(Condition)
    Value(Value)
    }

    Datum is the reader-level data representation used by quote. It is also used to store list/vector elements, so it includes runtime-only variants for records/conditions even though the reader never produces them.

    EnumSet

    pub struct EnumSet {
    id : Int
    universe : Array[String]
    members : Array[Bool]
    }

    Enum set value with a fixed universe ordering.

    EnumSet::new

    fn EnumSet::new(id : Int, universe : Array[String], members : Array[Bool]) -> EnumSet

    EnumSetProc

    pub struct EnumSetProc {
    id : Int
    kind : EnumSetProcKind
    }

    EnumSetProc::new

    fn EnumSetProc::new(id : Int, kind : EnumSetProcKind) -> EnumSetProc

    EnumSetProcKind

    pub(all) enum EnumSetProcKind {
    Constructor(EnumSet)
    Indexer(EnumSet)
    }

    EvalEnv

    pub struct EvalEnv {
    id : Int
    env : Array[Map[String, Binding]]
    }

    EvalEnv::new

    fn EvalEnv::new(id : Int, env : Array[Map[String, Binding]]) -> EvalEnv

    Formals

    pub struct Formals {
    params : Array[String]
    rest : String?
    }

    Formals::new

    fn Formals::new(params : Array[String], rest : String?) -> Formals

    GuardHandler

    pub struct GuardHandler {
    id : Int
    name : String
    clauses : Array[Datum]
    env : Array[Map[String, Binding]]
    resume_value : Value
    handlers : Array[Value]
    }

    GuardHandler::new

    fn GuardHandler::new(id : Int, name : String, clauses : Array[Datum], env : Array[Map[String, Binding]], resume_value : Value, handlers : Array[Value]) -> GuardHandler

    GuardInfo

    pub struct GuardInfo {
    condition : Value
    resume_value : Value
    handlers : Array[Value]
    raise_kont : Kont
    continuable : Bool
    }

    GuardInfo::new

    fn GuardInfo::new(condition : Value, resume_value : Value, handlers : Array[Value], raise_kont : Kont, continuable : Bool) -> GuardInfo

    Hashtable

    pub struct Hashtable {
    id : Int
    mutable : Bool
    equiv : HashtableEquiv
    hash : Value?
    entries :
    Ref
    [Array[HashtableEntry]]
    }

    Hashtable with configured equivalence and hash function.

    Hashtable::new

    fn Hashtable::new(id : Int, mutable : Bool, equiv : HashtableEquiv, hash : Value?, entries : Array[HashtableEntry]) -> Hashtable

    HashtableEntry

    pub struct HashtableEntry {
    key : Value
    value :
    Ref
    [Value]
    }

    HashtableEntry::new

    fn HashtableEntry::new(key : Value, value : Value) -> HashtableEntry

    HashtableEquiv

    pub(all) enum HashtableEquiv {
    Eq
    Eqv
    Equal
    Proc(Value)
    }

    HashtableOp

    pub(all) enum HashtableOp {
    Ref(Value)
    Contains
    Set(Value)
    Delete
    Update(Value, Value)
    }

    Kont

    pub(all) enum Kont {
    Halt
    If(Datum, Datum, Array[Map[String, Binding]], Kont)
    Begin(Array[Datum], Array[Map[String, Binding]], Kont)
    Set(String, Array[Map[String, Binding]], Kont)
    Define(String, Array[Map[String, Binding]], Kont)
    AppFun(Array[Datum], Array[Map[String, Binding]], Kont)
    AppArgs(Value, Array[Value], Array[Datum], Array[Map[String, Binding]], Kont)
    And(Array[Datum], Array[Map[String, Binding]], Kont)
    Or(Array[Datum], Array[Map[String, Binding]], Kont)
    Cond(Array[Datum], Array[Datum], Array[Map[String, Binding]], Kont)
    CondArrow(Value, Kont)
    Let(Array[(String, Datum)], Int, Array[Value], Array[Map[String, Binding]], Array[Datum], Kont)
    LetStar(Array[(String, Datum)], Int, Array[Map[String, Binding]], Array[Datum], Kont)
    LetRec(Array[(String, Datum)], Int, Array[Map[String, Binding]], Array[Datum], Kont)
    LetRecInit(Array[(String, Datum)], Int, Array[Value], Array[Map[String, Binding]], Array[Datum], Kont)
    LetValues(Array[(Formals, Datum)], Int, Array[Array[(String, Value)]], Array[Map[String, Binding]], Array[Datum], Kont)
    LetStarValues(Array[(Formals, Datum)], Int, Array[Map[String, Binding]], Array[Datum], Kont)
    DefineValues(Formals, Array[Map[String, Binding]], Kont)
    SyntaxCase(Array[Datum], Array[Map[String, Binding]], Kont)
    ParameterizeParam(Array[(Datum, Datum)], Int, Array[Parameter], Array[Value], Array[Map[String, Binding]], Array[Datum], Kont)
    ParameterizeValue(Array[(Datum, Datum)], Int, Array[Parameter], Array[Value], Array[Map[String, Binding]], Array[Datum], Kont)
    ParameterizeConvert(Array[(Datum, Datum)], Int, Array[Parameter], Array[Value], Array[Map[String, Binding]], Array[Datum], Kont)
    MakeParameter(Value, Kont)
    SetParameter(Parameter, Kont)
    GuardResult(GuardInfo)
    GuardCond(Array[Datum], Array[Datum], Array[Map[String, Binding]], GuardInfo)
    GuardCondArrow(Value, GuardInfo)
    Case(Array[Datum], Array[Map[String, Binding]], Kont)
    CaseArrow(Value, Kont)
    CallWithValues(Value, Kont)
    RecordConstructorDone(Kont)
    RecordProtocolNApply(RecordType, Array[Value], Kont)
    RecordProtocolNResult(RecordType, Kont)
    DefineRecordType(String, String, RecordType, Array[RecordFieldBinding], Array[Map[String, Binding]], Kont)
    DefineConditionType(String, String, RecordType, Array[RecordFieldBinding], Array[Map[String, Binding]], Kont)
    HashtableFindResult(Hashtable, Value, Int, HashtableOp, Kont)
    HashtableUpdateApply(Hashtable, Value, Int, Bool, Kont)
    MapStep(Value, Array[Datum], Array[Datum], Bool, Kont)
    VectorMapFinalize(Kont)
    StringMapFinalize(Kont)
    WindEnter(Value, Winder, Kont)
    WindExit(Winder, Kont)
    WindActions(Array[WindAction], Value, Kont, Array[Value])
    WindPush(Winder, Array[WindAction], Value, Kont, Array[Value])
    ForcePromise(Promise, Kont)
    RaiseNonCont
    RaiseCont(Kont)
    RestoreHandlers(Array[Value], Kont)
    }

    Continuation frames for the evaluator.

    MacroTransformer

    pub(all) enum MacroTransformer {
    Rules(SyntaxRules)
    Procedure(Value, Array[Map[String, Binding]])
    }

    ParamBinding

    pub struct ParamBinding {
    param : Parameter
    old_value : Value
    new_value : Value
    }

    ParamBinding::new

    fn ParamBinding::new(param : Parameter, old_value : Value, new_value : Value) -> ParamBinding

    Parameter

    pub struct Parameter {
    id : Int
    value :
    Ref
    [Value]
    converter : Value?
    }

    Parameter::new

    fn Parameter::new(id : Int, value : Value, converter : Value?) -> Parameter

    Port

    pub struct Port {
    id : Int
    kind : PortKind
    }

    Runtime port descriptor.

    Port::new_output_string

    fn Port::new_output_string(id : Int, initial : String) -> Port

    PortKind

    pub enum PortKind {
    OutputString(
    Ref
    [String])
    }

    Kinds of runtime ports.

    Primitive

    pub(all) enum Primitive {
    Add
    Sub
    Mul
    Div
    NumEq
    Less
    Greater
    LessEq
    GreaterEq
    Eq
    Eqv
    Equal
    Cons
    Car
    Cdr
    List
    NullP
    PairP
    SymbolP
    SymbolEq
    IdentifierP
    SyntaxP
    FreeIdentifierEq
    BoundIdentifierEq
    SymbolToString
    StringToSymbol
    StringHash
    StringCiHash
    SymbolHash
    EqualHash
    SyntaxToDatum
    DatumToSyntax
    BooleanP
    BooleanEq
    NumberP
    IntegerP
    ExactIntegerP
    RationalP
    RealP
    ComplexP
    ExactP
    InexactP
    ZeroP
    PositiveP
    NegativeP
    OddP
    EvenP
    FiniteP
    InfiniteP
    NanP
    ProcedureP
    RecordP
    RecordRtd
    RecordTypeDescriptorP
    RecordConstructorDescriptorP
    RecordTypeName
    RecordTypeParent
    RecordTypeUid
    RecordTypeGenerativeP
    RecordTypeSealedP
    RecordTypeOpaqueP
    RecordTypeFieldNames
    RecordTypeFieldMutableP
    RecordConstructorDescriptor
    RecordConstructor
    RecordPredicate
    RecordAccessor
    RecordMutator
    MakeRecordTypeDescriptor
    MakeRecordConstructorDescriptor
    Condition
    ConditionP
    SimpleConditions
    ConditionPredicate
    ConditionAccessor
    MakeEqHashtable
    MakeEqvHashtable
    MakeHashtable
    HashtableP
    HashtableSize
    HashtableRef
    HashtableSet
    HashtableDelete
    HashtableContainsP
    HashtableUpdate
    HashtableCopy
    HashtableClear
    HashtableKeys
    HashtableEntries
    HashtableEquivalenceFunction
    HashtableHashFunction
    HashtableMutableP
    MakeEnumeration
    EnumSetUniverse
    EnumSetIndexer
    EnumSetConstructor
    EnumSetP
    EnumSetMemberP
    EnumSetSubsetP
    EnumSetEq
    EnumSetUnion
    EnumSetIntersection
    EnumSetDifference
    EnumSetComplement
    EnumSetProjection
    EnumSetToList
    Not
    Apply
    CallCC
    Values
    CallWithValues
    MakeParameter
    DynamicWind
    Eval
    Environment
    PromiseP
    MakePromise
    Force
    ExactToInexact
    InexactToExact
    ExactIntegerSqrt
    Rationalize
    NumberToString
    StringToNumber
    MakeRectangular
    MakePolar
    RealPart
    ImagPart
    Magnitude
    Angle
    Sqrt
    Exp
    Log
    Expt
    Sin
    Cos
    Tan
    Asin
    Acos
    Atan
    Numerator
    Denominator
    Abs
    Quotient
    Remainder
    Modulo
    Gcd
    Lcm
    Max
    Min
    Floor
    Ceiling
    Truncate
    Round
    BitwiseAnd
    BitwiseIor
    BitwiseXor
    BitwiseNot
    BitwiseIf
    ArithmeticShift
    BitwiseBitCount
    BitwiseLength
    BitwiseFirstBitSet
    BitwiseBitSetP
    BitwiseCopyBit
    BitwiseBitField
    BitwiseCopyBitField
    BitwiseRotateBitField
    BitwiseReverseBitField
    FixnumP
    FixnumWidth
    LeastFixnum
    GreatestFixnum
    FxEq
    FxLess
    FxGreater
    FxLessEq
    FxGreaterEq
    FxZeroP
    FxPositiveP
    FxNegativeP
    FxOddP
    FxEvenP
    FxMin
    FxMax
    FxAdd
    FxSub
    FxMul
    FxDiv
    FxMod
    FxDiv0
    FxMod0
    FxAddCarry
    FxSubCarry
    FxMulCarry
    FxNot
    FxAnd
    FxIor
    FxXor
    FxIf
    FxBitCount
    FxLength
    FxFirstBitSet
    FxBitSetP
    FxCopyBit
    FxBitField
    FxCopyBitField
    FxRotateBitField
    FxReverseBitField
    FxArithmeticShift
    FxArithmeticShiftLeft
    FxArithmeticShiftRight
    FlonumP
    RealToFlonum
    FixnumToFlonum
    FlEq
    FlLess
    FlGreater
    FlLessEq
    FlGreaterEq
    FlIntegerP
    FlZeroP
    FlPositiveP
    FlNegativeP
    FlOddP
    FlEvenP
    FlFiniteP
    FlInfiniteP
    FlNanP
    FlMax
    FlMin
    FlAdd
    FlMul
    FlSub
    FlDiv
    FlAbs
    FlDivAndMod
    FlDivInt
    FlMod
    FlDiv0AndMod0
    FlDiv0
    FlMod0
    FlNumerator
    FlDenominator
    FlFloor
    FlCeiling
    FlTruncate
    FlRound
    FlExp
    FlLog
    FlSin
    FlCos
    FlTan
    FlAsin
    FlAcos
    FlAtan
    FlSqrt
    FlExpt
    MakeVariableTransformer
    GenerateTemporaries
    ListP
    MakeList
    Length
    Append
    Reverse
    ListRef
    ListTail
    Cxr(String)
    Member
    Memq
    Memv
    Assoc
    Assq
    Assv
    Map
    ForEach
    SetCar
    SetCdr
    ListCopy
    CharEq
    CharLess
    CharGreater
    CharLessEq
    CharGreaterEq
    CharCiEq
    CharCiLess
    CharCiGreater
    CharCiLessEq
    CharCiGreaterEq
    CharP
    CharToInteger
    IntegerToChar
    CharAlphabeticP
    CharNumericP
    CharWhitespaceP
    CharUpperCaseP
    CharLowerCaseP
    CharUpcase
    CharDowncase
    CharFoldcase
    CharGeneralCategory
    StringEq
    StringLess
    StringGreater
    StringLessEq
    StringGreaterEq
    StringCiEq
    StringCiLess
    StringCiGreater
    StringCiLessEq
    StringCiGreaterEq
    String
    MakeString
    StringP
    StringLength
    StringAppend
    StringRef
    StringSet
    StringCopy
    Substring
    StringCopyBang
    StringFill
    StringToList
    ListToString
    StringMap
    StringForEach
    StringUpcase
    StringDowncase
    StringFoldcase
    StringNormalizeNfc
    StringNormalizeNfd
    StringNormalizeNfkc
    StringNormalizeNfkd
    Vector
    MakeVector
    VectorP
    VectorLength
    VectorRef
    VectorSet
    VectorFill
    VectorToList
    ListToVector
    VectorCopy
    VectorCopyBang
    VectorAppend
    VectorMap
    VectorForEach
    ByteVector
    MakeByteVector
    ByteVectorP
    ByteVectorLength
    ByteVectorEq
    ByteVectorU8Ref
    ByteVectorU8Set
    ByteVectorCopy
    ByteVectorCopyBang
    ByteVectorAppend
    ByteVectorFill
    ByteVectorToU8List
    U8ListToByteVector
    StringToUtf8
    Utf8ToString
    NativeEndianness
    ByteVectorUintRef
    ByteVectorSintRef
    ByteVectorUintSet
    ByteVectorSintSet
    Display
    Write
    Newline
    OpenOutputString
    GetOutputString
    CurrentOutputPort
    WithExceptionHandler
    Raise
    RaiseContinuable
    Error
    AssertionViolation
    ImplementationRestrictionViolation
    UndefinedViolation
    SyntaxViolation
    } derive(Eq)

    Primitive::equal

    fn Primitive::equal(Primitive, Primitive) -> Bool

    Primitive::not_equal

    fn Primitive::not_equal(x : Primitive, y : Primitive) -> Bool

    Promise

    pub struct Promise {
    id : Int
    state :
    Ref
    [PromiseState]
    }

    Promise::new

    fn Promise::new(id : Int, state : PromiseState) -> Promise

    PromiseState

    pub(all) enum PromiseState {
    Thunk(Value)
    Value(Value)
    }

    Record

    pub struct Record {
    id : Int
    record_type : RecordType
    fields : Array[
    Ref
    [Value]]
    }

    Record instance with boxed fields.

    Record::new

    fn Record::new(id : Int, record_type : RecordType, values : Array[Value]) -> Record

    RecordConstructorDescriptor

    pub struct RecordConstructorDescriptor {
    id : Int
    record_type : RecordType
    parent_desc : RecordConstructorDescriptor?
    protocol : Value?
    }

    RecordConstructorDescriptor::new

    fn RecordConstructorDescriptor::new(id : Int, record_type : RecordType, parent_desc : RecordConstructorDescriptor?, protocol : Value?) -> RecordConstructorDescriptor

    RecordField

    pub struct RecordField {
    name : String
    mutable : Bool
    }

    RecordField::new

    fn RecordField::new(name : String, mutable : Bool) -> RecordField

    RecordFieldBinding

    pub struct RecordFieldBinding {
    accessor : String
    index : Int
    mutator : String?
    }

    Record field binding details for generated accessors.

    RecordFieldBinding::accessor

    fn RecordFieldBinding::accessor(self : RecordFieldBinding) -> String

    Return the accessor name.

    RecordFieldBinding::index

    fn RecordFieldBinding::index(self : RecordFieldBinding) -> Int

    Return the field index.

    RecordFieldBinding::mutator

    fn RecordFieldBinding::mutator(self : RecordFieldBinding) -> String?

    Return the mutator name, if any.

    RecordFieldBinding::new

    fn RecordFieldBinding::new(accessor : String, index : Int, mutator : String?) -> RecordFieldBinding

    Create a record field binding.

    Example

    test "record field binding" {
    let binding = RecordFieldBinding::new("get", 0, None)
    inspect(binding.accessor(), content="get")
    inspect(binding.index(), content="0")
    debug_inspect(binding.mutator(), content="None")
    }

    RecordProc

    pub struct RecordProc {
    id : Int
    kind : RecordProcKind
    }

    Record-related procedure wrapper.

    RecordProc::new

    fn RecordProc::new(id : Int, kind : RecordProcKind) -> RecordProc

    RecordProcKind

    pub(all) enum RecordProcKind {
    Constructor(RecordType)
    Predicate(RecordType)
    Accessor(RecordType, Int)
    Mutator(RecordType, Int)
    ProtocolN(RecordType, RecordConstructorDescriptor)
    ProtocolP(RecordType, Array[Value])
    }

    RecordType

    pub struct RecordType {
    id : Int
    name : String
    parent : RecordType?
    is_sealed : Bool
    is_opaque : Bool
    uid : String?
    fields : Array[RecordField]
    }

    Record type metadata used by the runtime.

    RecordType::new

    fn RecordType::new(id : Int, name : String, parent : RecordType?, is_sealed : Bool, is_opaque : Bool, uid : String?, fields : Array[RecordField]) -> RecordType

    RecordTypeDescriptor

    pub struct RecordTypeDescriptor {
    id : Int
    record_type : RecordType
    constructor_desc : RecordConstructorDescriptor
    }

    RecordTypeDescriptor::new

    fn RecordTypeDescriptor::new(id : Int, record_type : RecordType, constructor_desc : RecordConstructorDescriptor) -> RecordTypeDescriptor

    SyntaxObject

    pub struct SyntaxObject {
    datum : Datum
    scopes : Array[Int]
    binding_id : Int?
    }

    SyntaxObject::new

    fn SyntaxObject::new(datum : Datum, scopes : Array[Int], binding_id : Int?) -> SyntaxObject

    SyntaxRule

    pub struct SyntaxRule {
    pattern : Datum
    template : Datum
    fender : Datum?
    }

    SyntaxRule::new

    fn SyntaxRule::new(pattern : Datum, template : Datum, fender : Datum?) -> SyntaxRule

    SyntaxRules

    pub struct SyntaxRules {
    literals : Array[String]
    rules : Array[SyntaxRule]
    ellipsis : String
    kind : SyntaxRulesKind
    def_env : Array[Map[String, Binding]]
    }

    SyntaxRules::new

    fn SyntaxRules::new(literals : Array[String], rules : Array[SyntaxRule], ellipsis : String, kind : SyntaxRulesKind, def_env : Array[Map[String, Binding]]) -> SyntaxRules

    SyntaxRulesKind

    pub(all) enum SyntaxRulesKind {
    SyntaxRules
    SyntaxCase
    }

    UnicodeChar

    pub struct UnicodeChar {
    value : Char
    }

    UnicodeChar::downcase

    fn UnicodeChar::downcase(self : UnicodeChar) -> Char

    Lowercase a character using Unicode case mapping.

    Example

    test "char downcase" {
    inspect(UnicodeChar::new('A').downcase(), content="a")
    }

    UnicodeChar::foldcase

    fn UnicodeChar::foldcase(self : UnicodeChar) -> Char

    Case-fold a character for case-insensitive comparison.

    Example

    test "char foldcase" {
    inspect(UnicodeChar::new('A').foldcase(), content="a")
    }

    UnicodeChar::general_category

    fn UnicodeChar::general_category(self : UnicodeChar) -> String

    Return the general category tag for the character.

    Example

    test "general category" {
    inspect(UnicodeChar::new('A').general_category(), content="Lu")
    }

    UnicodeChar::is_alphabetic

    fn UnicodeChar::is_alphabetic(self : UnicodeChar) -> Bool

    Return true if the character is alphabetic.

    Example

    test "alphabetic predicate" {
    inspect(UnicodeChar::new('A').is_alphabetic(), content="true")
    inspect(UnicodeChar::new('1').is_alphabetic(), content="false")
    }

    UnicodeChar::is_lowercase

    fn UnicodeChar::is_lowercase(self : UnicodeChar) -> Bool

    Return true if the character is lowercase.

    Example

    test "lowercase predicate" {
    inspect(UnicodeChar::new('a').is_lowercase(), content="true")
    inspect(UnicodeChar::new('A').is_lowercase(), content="false")
    }

    UnicodeChar::is_uppercase

    fn UnicodeChar::is_uppercase(self : UnicodeChar) -> Bool

    Return true if the character is uppercase.

    Example

    test "uppercase predicate" {
    inspect(UnicodeChar::new('A').is_uppercase(), content="true")
    inspect(UnicodeChar::new('a').is_uppercase(), content="false")
    }

    UnicodeChar::new

    fn UnicodeChar::new(ch : Char) -> UnicodeChar

    Wrap a Char to access Unicode helpers with chaining.

    Example

    test "unicode char wrapper" {
    inspect(UnicodeChar::new('A').is_uppercase(), content="true")
    }

    UnicodeChar::upcase

    fn UnicodeChar::upcase(self : UnicodeChar) -> Char

    Uppercase a character using Unicode case mapping.

    Example

    test "char upcase" {
    inspect(UnicodeChar::new('a').upcase(), content="A")
    }

    UnicodeString

    pub struct UnicodeString {
    value : String
    }

    UnicodeString::downcase

    fn UnicodeString::downcase(self : UnicodeString) -> UnicodeString

    Lowercase a string using Unicode case mapping.

    Example

    test "string downcase" {
    inspect(UnicodeString::new("ABC").downcase().into_string(), content="abc")
    }

    UnicodeString::foldcase

    fn UnicodeString::foldcase(self : UnicodeString) -> UnicodeString

    Case-fold a string for case-insensitive comparison.

    Example

    test "string foldcase" {
    inspect(UnicodeString::new("ABC").foldcase().into_string(), content="abc")
    }

    UnicodeString::into_string

    fn UnicodeString::into_string(self : UnicodeString) -> String

    Unwrap a Unicode string wrapper back into a String.

    Example

    test "unicode string into_string" {
    let wrapped = UnicodeString::new("Hi")
    inspect(wrapped.into_string(), content="Hi")
    }

    UnicodeString::new

    fn UnicodeString::new(s : String) -> UnicodeString

    Wrap a String to access Unicode helpers with chaining.

    Example

    test "unicode string wrapper" {
    inspect(
    UnicodeString::new("e\u{301}").normalize_nfc().foldcase().into_string(),
    content="\u{00e9}",
    )
    }

    UnicodeString::normalize_nfc

    fn UnicodeString::normalize_nfc(self : UnicodeString) -> UnicodeString

    Normalize a string to Unicode NFC.

    Example

    test "normalize nfc" {
    inspect(
    UnicodeString::new("e\u{301}").normalize_nfc().into_string(),
    content="\u{00e9}",
    )
    }

    UnicodeString::normalize_nfd

    fn UnicodeString::normalize_nfd(self : UnicodeString) -> UnicodeString

    Normalize a string to Unicode NFD.

    Example

    test "normalize nfd" {
    inspect(
    UnicodeString::new("\u{00e9}").normalize_nfd().into_string(),
    content="e\u{301}",
    )
    }

    UnicodeString::normalize_nfkc

    fn UnicodeString::normalize_nfkc(self : UnicodeString) -> UnicodeString

    Normalize a string to Unicode NFKC.

    Example

    test "normalize nfkc" {
    inspect(
    UnicodeString::new("\u{212b}").normalize_nfkc().into_string(),
    content="\u{00c5}",
    )
    }

    UnicodeString::normalize_nfkd

    fn UnicodeString::normalize_nfkd(self : UnicodeString) -> UnicodeString

    Normalize a string to Unicode NFKD.

    Example

    test "normalize nfkd" {
    inspect(
    UnicodeString::new("\u{212b}").normalize_nfkd().into_string(),
    content="A\u{30a}",
    )
    }

    UnicodeString::upcase

    Uppercase a string using Unicode case mapping.

    Example

    test "string upcase" {
    inspect(UnicodeString::new("abc").upcase().into_string(), content="ABC")
    }

    Value

    pub(all) enum Value {
    Void
    Datum(Datum)
    Primitive(Primitive)
    Closure(Closure)
    CaseClosure(CaseClosure)
    Values(Array[Value])
    GuardHandler(GuardHandler)
    Parameter(Parameter)
    Promise(Promise)
    EvalEnv(EvalEnv)
    Continuation(Continuation)
    Port(Port)
    Record(Record)
    RecordProc(RecordProc)
    ConditionProc(ConditionProc)
    Hashtable(Hashtable)
    EnumSet(EnumSet)
    EnumSetProc(EnumSetProc)
    RecordTypeDescriptor(RecordTypeDescriptor)
    RecordConstructorDescriptor(RecordConstructorDescriptor)
    SyntaxObject(SyntaxObject)
    SyntaxKeyword(String)
    Macro(MacroTransformer)
    }

    WindAction

    pub(all) enum WindAction {
    After(Winder)
    Before(Winder)
    SwitchHandlers(Array[Value])
    }

    Winder

    pub struct Winder {
    id : Int
    kind : WinderKind
    }

    Winder::new_params

    fn Winder::new_params(id : Int, bindings : Array[ParamBinding]) -> Winder

    Winder::new_proc

    fn Winder::new_proc(id : Int, before : Value, after : Value) -> Winder

    WinderKind

    pub enum WinderKind {
    Proc(Value, Value)
    Params(Array[ParamBinding])
    }