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
|
(define-syntax (defthing stx)
|
||||||
(syntax-rules ()
|
(syntax-parse stx
|
||||||
[(_ #:kind kind id result desc ...)
|
[(_ kind:kind-kw
|
||||||
(with-togetherable-racket-variables
|
(~optional (~seq #:id id-expr)
|
||||||
()
|
#:defaults ([id-expr #'#f]))
|
||||||
()
|
id
|
||||||
(*defthing kind
|
result
|
||||||
(list (quote-syntax/loc id)) (list 'id) #f
|
desc ...)
|
||||||
(list (racketblock0 result))
|
#'(with-togetherable-racket-variables
|
||||||
(lambda () (list desc ...))))]
|
()
|
||||||
[(_ id result desc ...)
|
()
|
||||||
(defthing #:kind #f id result desc ...)]))
|
(*defthing kind.kind
|
||||||
|
(list (or id-expr (quote-syntax/loc id))) (list 'id) #f
|
||||||
|
(list (racketblock0 result))
|
||||||
|
(lambda () (list desc ...))))]))
|
||||||
|
|
||||||
(define-syntax defthing*
|
(define-syntax defthing*
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
|
|
|
@ -1040,18 +1040,26 @@ Like @racket[defparam], but the contract on a parameter argument is
|
||||||
@racket[boolean?].}
|
@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.
|
Like @racket[defproc], but for a non-procedure binding.
|
||||||
|
|
||||||
If @racket[#:kind kind-string-expr] is supplied as
|
If @racket[#:kind kind-string-expr] is supplied,
|
||||||
@racket[maybe-kind], it is used in the same way as for
|
it is used in the same way as for
|
||||||
@racket[defproc], but the default kind is @racket["value"].
|
@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:
|
Examples:
|
||||||
@codeblock[#:keep-lang-line? #f]|{
|
@codeblock[#:keep-lang-line? #f]|{
|
||||||
#lang scribble/manual
|
#lang scribble/manual
|
||||||
@defthing[moldy-sandwich sandwich?]
|
@defthing[moldy-sandwich sandwich?]{
|
||||||
Don't eat this. Provided for backwards compatibility.
|
Don't eat this. Provided for backwards compatibility.
|
||||||
}
|
}
|
||||||
}|
|
}|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user