Documentation
¶
Overview ¶
Package schemeutil provides conversion utilities between syntax, datum, and Go types.
Syntax/Datum Conversion ¶
- SyntaxValueToDatum: strip source location and scope info from syntax
- DatumToSyntaxValue: wrap raw values with source context
- IsSyntaxComment: check for comment syntax types
Boolean Conversion ¶
For implementing Scheme predicates and control flow:
- BoolToBoolean: Go bool -> Scheme #t/#f
- BooleanToBool: Scheme #t/#f -> Go bool
- ValueToBool: Scheme truthiness (only #f is false)
- ValueToBoolean: coerce any value to Scheme boolean
Collection ¶
- [AsList]: convert Go slice to proper Scheme list
Index ¶
- func BoolToBoolean(b bool) *values.Boolean
- func BooleanToBool(b *values.Boolean) bool
- func DatumToSyntaxValue(ctx context.Context, sctx *syntax.SourceContext, o values.Value) syntax.SyntaxValue
- func IsSyntaxComment(v values.Value) bool
- func SyntaxValueToDatum(sv values.Value) values.Value
- func ValueToBool(b values.Value) bool
- func ValueToBoolean(b values.Value) *values.Boolean
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolToBoolean ¶
BoolToBoolean converts a Go bool to a Scheme boolean value.
func BooleanToBool ¶
BooleanToBool converts a Scheme *Boolean to a Go bool value.
func DatumToSyntaxValue ¶
func DatumToSyntaxValue(ctx context.Context, sctx *syntax.SourceContext, o values.Value) syntax.SyntaxValue
DatumToSyntaxValue wraps a raw Scheme datum in syntax objects, attaching the provided SourceContext for source location and scope tracking. Recursively wraps pairs, vectors, and boxed values. If the input is already a SyntaxValue, it is returned unchanged.
func IsSyntaxComment ¶
IsSyntaxComment returns true if the given value is a SyntaxComment.
func SyntaxValueToDatum ¶
SyntaxValueToDatum converts a syntax object back to a raw Scheme datum, stripping away source location and scope information. Recursively unwraps pairs, vectors, and boxed values.
func ValueToBool ¶
ValueToBool converts a value into a Go bool using Scheme semantics.
Types ¶
This section is empty.