req-trans and flatten doc clarifications

svn: r8946
This commit is contained in:
Matthew Flatt 2008-03-11 13:32:39 +00:00
parent 3910b99921
commit d158302f1c
2 changed files with 29 additions and 16 deletions

View File

@ -41,6 +41,11 @@
#'(defproc (name [v contract]) any/c
"Returns " (to-element 'equiv)))))]))
@(define list-eval (make-base-eval))
@interaction-eval[#:eval list-eval (require scheme/list)]
@title[#:tag "pairs"]{Pairs and Lists}
A @deftech{pair} combines exactly two values. The first value is
@ -269,18 +274,6 @@ Like @scheme[foldl], but the lists are traversed from right to left.
(foldr (lambda (v l) (cons (add1 v) l)) '() '(1 2 3 4))
]}
@defproc[(flatten [x any/c])
list?]{
Flattens an arbitrary S-expression structure of pairs to a list. Note
that this function never raises an error, since all values are valid
S-expressions.
@examples[
(flatten '((x) x (x (x) x) ()))
(flatten 'x)
]}
@; ----------------------------------------
@section{List Filtering}
@ -447,7 +440,7 @@ Like @scheme[assoc], but finds an element using the predicate
@defc_r[d d d d]
@; ----------------------------------------
@section{List Synonyms}
@section{List Synonyms and More}
@note-lib[scheme/list]
@ -481,6 +474,21 @@ Like @scheme[assoc], but finds an element using the predicate
@defproc[(last [lst list?]) any]{Returns the last element of the list.}
@defproc[(flatten [v any/c])
list?]{
Flattens an arbitrary S-expression structure of pairs into a
list. More precisely, @scheme[v] is treated as a binary tree where
pairs are interior nodes, and the resulting list contains all of the
non-@scheme[null] leaves of the tree in the same order as an inorder
traversal.
@examples[
#:eval list-eval
(flatten '((a) b (c (d) . e) ()))
(flatten 'a)
]}
@; ----------------------------------------
@section{Immutable Cyclic Data}

View File

@ -532,8 +532,12 @@ See also @scheme[define-require-syntax], which supports macro-style
(listof import-source?))]{
Expands the given @scheme[_require-spec] to lists of imports and
import sources. Note that the import sources specify modules to be
visited, so this list is independent of the imports list.}
import sources. The latter specifies modules to be
@tech{instantiate}d or @tech{visit}ed, so the modules that it
represents should be a superset of the modules represented in the
former list (so that a module will be @tech{instantiate}d or
@tech{visit}ed even if all of imports are eventually filtered from the
former list).}
@defproc[(make-require-transformer [proc ((syntax?) . ->* . ((listof import?)
@ -600,7 +604,8 @@ A structure representing a single imported identifier:
[mode (or/c exact-integer? false/c)])]{
A structure representing an imported module, which must be
instantiated or visited even if no binding is imported into a module.
@tech{instantiate}d or @tech{visit}ed even if no binding is imported
into a module.
@itemize{