remove racket/nest, since 'nest' didn't catch on
This commit is contained in:
parent
327408c12f
commit
e6e06bb1a3
|
@ -24,7 +24,6 @@
|
|||
racket/promise
|
||||
racket/bool
|
||||
racket/local
|
||||
racket/nest
|
||||
(for-syntax racket/base))
|
||||
|
||||
(provide (all-from-out racket/contract
|
||||
|
@ -50,6 +49,5 @@
|
|||
racket/cmdline
|
||||
racket/promise
|
||||
racket/bool
|
||||
racket/local
|
||||
racket/nest)
|
||||
racket/local)
|
||||
(for-syntax (all-from-out racket/base)))
|
||||
|
|
|
@ -1,2 +1,28 @@
|
|||
#lang scheme/private/provider
|
||||
racket/nest
|
||||
#lang scheme/base
|
||||
|
||||
(provide nest)
|
||||
|
||||
;; A form that makes it easy to combine many "right-drifting" nested
|
||||
;; expressions into a single one, sort of like a generalized version of the `*'
|
||||
;; from `let*' and similar forms.
|
||||
(define-syntax nest
|
||||
(syntax-rules ()
|
||||
[(nest () body0 body ...)
|
||||
(let () body0 body ...)]
|
||||
;; this allows putting definitions in the body
|
||||
[(nest ([form forms ...]) body0 body ...)
|
||||
(form forms ... (let () body0 body ...))]
|
||||
[(nest ([form forms ...] . more) body0 body ...)
|
||||
(form forms ... (nest more body0 body ...))]))
|
||||
|
||||
;; using this instead will allow splicing body expressions in the last form
|
||||
;; whatever it happens to be, which can be (ab)used in strange ways
|
||||
#;
|
||||
(define-syntax nest
|
||||
(syntax-rules ()
|
||||
[(nest () body ...)
|
||||
(begin body ...)]
|
||||
[(nest ([form forms ...]) body ...)
|
||||
(form forms ... body ...)]
|
||||
[(nest ([form forms ...] . more) body ...)
|
||||
(form forms ... (nest more body ...))]))
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
make-provide-transformer)
|
||||
racket/provide-syntax
|
||||
racket/provide
|
||||
racket/nest
|
||||
racket/package
|
||||
racket/splicing
|
||||
racket/runtime-path))
|
||||
|
@ -2414,54 +2413,6 @@ provides a hook to control interactive evaluation through
|
|||
@;------------------------------------------------------------------------
|
||||
@include-section["package.scrbl"]
|
||||
|
||||
@;------------------------------------------------------------------------
|
||||
@section[#:tag "nest"]{Flattening Syntactic Sequences: @racket[nest]}
|
||||
|
||||
@note-lib[racket/nest]
|
||||
|
||||
@defform[(nest ([datum ...+] ...) body ...+)]{
|
||||
|
||||
Combines nested expressions that syntactically drift to the right into
|
||||
a more linear textual format, much in the same way that @racket[let*]
|
||||
linearizes a sequence of nested @racket[let] expressions.
|
||||
|
||||
For example,
|
||||
|
||||
@racketblock[
|
||||
(nest ([let ([x 10]
|
||||
[y 6])]
|
||||
[with-handlers ([exn:fail? (lambda (x) 15)])]
|
||||
[parameterize ([current-output-port (current-error-port)])]
|
||||
[let-values ([(d r) (quotient/remainder x y)])])
|
||||
(display (+ d r)))
|
||||
]
|
||||
|
||||
is equivalent to
|
||||
|
||||
@racketblock[
|
||||
(let ([x 10]
|
||||
[y 6])
|
||||
(with-handlers ([exn:fail? (lambda (x) 15)])
|
||||
(parameterize ([current-output-port (current-error-port)])
|
||||
(let-values ([(d r) (quotient/remainder x y)])
|
||||
(display (+ d r))))))
|
||||
]
|
||||
|
||||
The @racket[nest] form is unusual in that it has no semantics apart
|
||||
from its expansion, and its implementation is easier to understand
|
||||
than a precise prose description:
|
||||
|
||||
@racketblock[
|
||||
(define-syntax nest
|
||||
(syntax-rules ()
|
||||
[(nest () body0 body ...)
|
||||
(let () body0 body ...)]
|
||||
[(nest ([form forms ...]) body0 body ...)
|
||||
(form forms ... (let () body0 body ...))]
|
||||
[(nest ([form forms ...] . more) body0 body ...)
|
||||
(form forms ... (nest more body0 body ...))]))
|
||||
]}
|
||||
|
||||
|
||||
@close-eval[require-eval]
|
||||
@close-eval[meta-in-eval]
|
||||
|
|
|
@ -34,8 +34,9 @@ old name.
|
|||
@table-of-contents[]
|
||||
|
||||
@compat-except[scheme racket]{, except that @schememodname[racket]'s
|
||||
@scheme[struct] is not exported, and a @|unit-struct| from
|
||||
@schememodname[scheme/unit] is exported, instead}
|
||||
@scheme[struct] is not exported, the @|unit-struct| from
|
||||
@schememodname[scheme/unit] is exported, @schememodname[scheme/set]
|
||||
is not re-exported, and @schememodname[scheme/nest] is re-exported}
|
||||
|
||||
@compat-except[scheme/base racket/base]{, except that
|
||||
@schememodname[racket]'s @scheme[struct] is not exported, and
|
||||
|
@ -111,7 +112,57 @@ must occur after all the @scheme[provide*] forms to which it refers.}
|
|||
@compat[scheme/match racket/match]
|
||||
@compat[scheme/math racket/math]
|
||||
@compat[scheme/mpair racket/mpair]
|
||||
@compat[scheme/nest racket/nest]
|
||||
|
||||
@;------------------------------------------------------------------------
|
||||
@section[#:tag "nest"]{schememodname[scheme/nest]}
|
||||
|
||||
@defmodule[scheme/nest]
|
||||
|
||||
@defform[(nest ([datum ...+] ...) body ...+)]{
|
||||
|
||||
Combines nested expressions that syntactically drift to the right into
|
||||
a more linear textual format, much in the same way that @racket[let*]
|
||||
linearizes a sequence of nested @racket[let] expressions.
|
||||
|
||||
For example,
|
||||
|
||||
@racketblock[
|
||||
(nest ([let ([x 10]
|
||||
[y 6])]
|
||||
[with-handlers ([exn:fail? (lambda (x) 15)])]
|
||||
[parameterize ([current-output-port (current-error-port)])]
|
||||
[let-values ([(d r) (quotient/remainder x y)])])
|
||||
(display (+ d r)))
|
||||
]
|
||||
|
||||
is equivalent to
|
||||
|
||||
@racketblock[
|
||||
(let ([x 10]
|
||||
[y 6])
|
||||
(with-handlers ([exn:fail? (lambda (x) 15)])
|
||||
(parameterize ([current-output-port (current-error-port)])
|
||||
(let-values ([(d r) (quotient/remainder x y)])
|
||||
(display (+ d r))))))
|
||||
]
|
||||
|
||||
The @racket[nest] form is unusual in that it has no semantics apart
|
||||
from its expansion, and its implementation is easier to understand
|
||||
than a precise prose description:
|
||||
|
||||
@racketblock[
|
||||
(define-syntax nest
|
||||
(syntax-rules ()
|
||||
[(nest () body0 body ...)
|
||||
(let () body0 body ...)]
|
||||
[(nest ([form forms ...]) body0 body ...)
|
||||
(form forms ... (let () body0 body ...))]
|
||||
[(nest ([form forms ...] . more) body0 body ...)
|
||||
(form forms ... (nest more body0 body ...))]))
|
||||
]}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@compat[scheme/package racket/package]
|
||||
@compat[scheme/path racket/path]
|
||||
@compat[scheme/port racket/port]
|
||||
|
|
Loading…
Reference in New Issue
Block a user