diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index 921c7fbc34..d4c1cadbc2 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -844,8 +844,8 @@ below, but it is the right choice for new contract constructors or first-time contract builders. The first argument is the name of the contract. It can be an -arbitrary s-expression. The second is a projection (see -above). +arbitrary S-expression. The second is a projection (see +above). The final argument is a predicate that is a conservative, first-order test of a value. It should be a @@ -861,7 +861,7 @@ functions, but reject all other values.} @defproc[(build-compound-type-name [c/s any/c] ...) any]{ -Produces an s-expression to be used as a name +Produces an S-expression to be used as a name for a contract. The arguments should be either contracts or symbols. It wraps parenthesis around its arguments and extracts the names from any contracts it is supplied with.} diff --git a/collects/scribblings/reference/pairs.scrbl b/collects/scribblings/reference/pairs.scrbl index ee4279c582..836078ed62 100644 --- a/collects/scribblings/reference/pairs.scrbl +++ b/collects/scribblings/reference/pairs.scrbl @@ -269,6 +269,19 @@ 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?]{ + +Like @scheme[foldl], but the lists are traversed from right to left. + Unlike @scheme[foldl], @scheme[foldr] processes the @scheme[lst]s in + space proportional to the length of @scheme[lst]s (plus the space for + each call to @scheme[proc]). + +@examples[ +(foldr cons '() '(1 2 3 4)) +(foldr (lambda (v l) (cons (add1 v) l)) '() '(1 2 3 4)) +]} + @; ---------------------------------------- @section{List Filtering}