Skip to content

Commit

Permalink
Add an example for defstruct*
Browse files Browse the repository at this point in the history
  • Loading branch information
LeifAndersen committed Nov 14, 2016
1 parent 5732384 commit 6b261eb
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions scribble-doc/scribblings/scribble/manual.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -1399,22 +1399,41 @@ definition. The @racket[defstruct*] form corresponds to @racket[struct],
while @racket[defstruct] corresponds to @racket[define-struct].

Examples:

An example using @racket[defstruct]:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defstruct[sandwich ([protein ingredient?] [sauce ingredient?])]{
A strucure type for sandwiches. Sandwiches are a pan-human foodstuff
A structure type for sandwiches. Sandwiches are a pan-human foodstuff
composed of a partially-enclosing bread material and various
ingredients.
}
}|
@doc-render-examples[
@defstruct[#:link-target? #f
sandwich ([protein ingredient?] [sauce ingredient?])]{
A strucure type for sandwiches. Sandwiches are a pan-human foodstuff
A structure type for sandwiches. Sandwiches are a pan-human foodstuff
composed of a partially-enclosing bread material and various
ingredients.
}]

Additionally, an example using @racket[defstruct*]:
@codeblock[#:keep-lang-line? #f]|{
#lang scribble/manual
@defstruct*[burrito ([salsa ingredient?] [tortilla ingredient?])]{
A structure type for burritos. Burritos are a pan-human foodstuff
composed of a @emph{fully}-encolosed bread material and various
ingredients.
}
}|
}
@doc-render-examples[
@defstruct*[#:link-target? #f
burrito ([salsa ingredient?] [tortilla ingredient?])]{
A structure type for burritos. Burritos are a pan-human foodstuff
composed of a @emph{fully}-encolosed bread material and various
ingredients.
}]


@defform[(deftogether [def-expr ...] pre-flow ...)]{
Expand Down

0 comments on commit 6b261eb

Please sign in to comment.