3.9 C Union Types
The primitive type constructor for creating new C union types. Like C struct types, union types are new primitive types with no conversion functions associated. Unions are always treated like structs with 'atomic allocation mode.
Creates a union type whose Racket representation is a union that works with union-ref and union-set!. The union is not copied; the Racket representation is backed by the underlying C representation.
Returns #t if v is a Racket representation of a C value via _union, #f otherwise.
Extracts a variant from a union. The variants are indexed starting at 0.
; see examples for union? for definitions > (union-ref a-union-val 1)
Sets a variant in a union.
; see examples for union? for definitions > (union-set! a-union-val 0 (list 4 5)) > a-union-val
> (union-ref a-union-val 0)
Extracts the pointer for a union’s storage.
> (union-ptr a-union-val)