Source code: https://github.com/AlexKnauth/struct-like-struct-type-property.
syntax
prop-option...)prop-option = #:propertyprop-exprval-expr
prop:name, a struct-type property
name, a constructor for a struct that implements the property
name?, a predicate for values that have the property
name-field... , an accessor for each field
The property prop:name expects a function that takes a "self" argument and returns a name result. When someone wants to use the value as a prop:name, this function should construct a more basic structure that contains the field values.
> (foo-a(foo123))1
> (foo?(foo"a""b""c"))#t
#:propertyprop:foo;when a bar is used as a foo, do this4
#t
5
The #:propertyprop-exprval-expr options specify super-properties. Anything that implements prop:name will automatically implement all the properties specified by the given prop-exprs.
#:propertyprop:procedure(quadratic-cself))))> (f0)-3
> (f1)-4
> (f2)-3
> (f3)0
> (f4)5
#:propertyprop:quadratic(quadraticabc)])))> (g0)-3
> (g1)-4
> (g2)-3
> (g3)0
> (g4)5