scribble/manual: add #:id' option to
defthing'
Use this open in the HtDP language documentation in the same way as for `defproc', which fixes the docs for `pi', `e', etc. original commit: 8d03995b628771e529aa56403dbdd29a8e0926d5
This commit is contained in:
parent
02d4fcbb0e
commit
ef2005e586
|
@ -913,18 +913,21 @@
|
|||
|
||||
;; ----------------------------------------
|
||||
|
||||
(define-syntax defthing
|
||||
(syntax-rules ()
|
||||
[(_ #:kind kind id result desc ...)
|
||||
(with-togetherable-racket-variables
|
||||
()
|
||||
()
|
||||
(*defthing kind
|
||||
(list (quote-syntax/loc id)) (list 'id) #f
|
||||
(list (racketblock0 result))
|
||||
(lambda () (list desc ...))))]
|
||||
[(_ id result desc ...)
|
||||
(defthing #:kind #f id result desc ...)]))
|
||||
(define-syntax (defthing stx)
|
||||
(syntax-parse stx
|
||||
[(_ kind:kind-kw
|
||||
(~optional (~seq #:id id-expr)
|
||||
#:defaults ([id-expr #'#f]))
|
||||
id
|
||||
result
|
||||
desc ...)
|
||||
#'(with-togetherable-racket-variables
|
||||
()
|
||||
()
|
||||
(*defthing kind.kind
|
||||
(list (or id-expr (quote-syntax/loc id))) (list 'id) #f
|
||||
(list (racketblock0 result))
|
||||
(lambda () (list desc ...))))]))
|
||||
|
||||
(define-syntax defthing*
|
||||
(syntax-rules ()
|
||||
|
|
|
@ -1040,18 +1040,26 @@ Like @racket[defparam], but the contract on a parameter argument is
|
|||
@racket[boolean?].}
|
||||
|
||||
|
||||
@defform[(defthing maybe-kind id contract-expr-datum pre-flow ...)]{
|
||||
@defform/subs[(defthing maybe-kind maybe-id id contract-expr-datum
|
||||
pre-flow ...)
|
||||
([maybe-kind code:blank
|
||||
(code:line #:kind kind-string-expr)]
|
||||
[maybe-id code:blank
|
||||
(code:line #:id id-expr)])]{
|
||||
|
||||
Like @racket[defproc], but for a non-procedure binding.
|
||||
|
||||
If @racket[#:kind kind-string-expr] is supplied as
|
||||
@racket[maybe-kind], it is used in the same way as for
|
||||
If @racket[#:kind kind-string-expr] is supplied,
|
||||
it is used in the same way as for
|
||||
@racket[defproc], but the default kind is @racket["value"].
|
||||
|
||||
If @racket[#:id id-expr] is supplied, then the result of
|
||||
@racket[id-expr] is used in place of @racket[id].
|
||||
|
||||
Examples:
|
||||
@codeblock[#:keep-lang-line? #f]|{
|
||||
#lang scribble/manual
|
||||
@defthing[moldy-sandwich sandwich?]
|
||||
@defthing[moldy-sandwich sandwich?]{
|
||||
Don't eat this. Provided for backwards compatibility.
|
||||
}
|
||||
}|
|
||||
|
|
Loading…
Reference in New Issue
Block a user