@@ -1467,16 +1467,20 @@ Examples:
1467
1467
1468
1468
1469
1469
@deftogether[(
1470
- @defform[ (defstruct* maybe-link struct-name ([field-name contract-expr-datum] ... )
1470
+ @defform[ (defstruct* maybe-link struct-name ([field contract-expr-datum] ... )
1471
1471
maybe-mutable maybe-non-opaque maybe-constructor
1472
1472
pre-flow ... )]
1473
- @defform/subs[ (defstruct maybe-link struct-name ([field-name contract-expr-datum] ... )
1473
+ @defform/subs[ (defstruct maybe-link struct-name ([field contract-expr-datum] ... )
1474
1474
maybe-mutable maybe-non-opaque maybe-constructor
1475
1475
pre-flow ... )
1476
1476
([maybe-link code:blank
1477
1477
(code:line #:link-target? link-target?-expr)]
1478
1478
[struct-name id
1479
1479
(id super-id)]
1480
+ [field field-id
1481
+ (field-id field-option ... )]
1482
+ [field-option #:mutable
1483
+ #:auto ]
1480
1484
[maybe-mutable code:blank
1481
1485
#:mutable ]
1482
1486
[maybe-non-opaque code:blank
@@ -1498,18 +1502,18 @@ Examples:
1498
1502
An example using @racket[defstruct]:
1499
1503
@codeblock[#:keep-lang-line? #f ]|{
1500
1504
#lang scribble/manual
1501
- @defstruct[sandwich ([protein ingredient?] [sauce ingredient?])]{
1505
+ @defstruct[sandwich ([( protein #:mutable ) ingredient?] [sauce ingredient?])]{
1502
1506
A structure type for sandwiches. Sandwiches are a pan-human foodstuff
1503
1507
composed of a partially-enclosing bread material and various
1504
- ingredients.
1508
+ ingredients. The @racketid[protein] field is mutable.
1505
1509
}
1506
1510
}|
1507
1511
@doc-render-examples[
1508
1512
@defstruct[#:link-target? #f
1509
- sandwich ([protein ingredient?] [sauce ingredient?])]{
1513
+ sandwich ([( protein #:mutable ) ingredient?] [sauce ingredient?])]{
1510
1514
A structure type for sandwiches. Sandwiches are a pan-human foodstuff
1511
1515
composed of a partially-enclosing bread material and various
1512
- ingredients.
1516
+ ingredients. The @racketid[protein] field is mutable.
1513
1517
}]
1514
1518
1515
1519
Additionally, an example using @racket[defstruct*]:
0 commit comments