Clarify docs for filter-map (#2405)

See discussion on the mailing list: https://groups.google.com/d/topic/racket-users/8vyJX9MqMFY/discussion
This commit is contained in:
Philip McGrath 2018-11-29 19:00:04 -05:00 committed by John Clements
parent 4d032bdd64
commit 4362e98b58

View File

@ -1235,7 +1235,11 @@ key value from each list element, so two items are considered equal if
@defproc[(filter-map [proc procedure?] [lst list?] ...+)
list?]{
Returns @racket[(filter (lambda (x) x) (map proc lst ...))], but without
Like @racket[(map proc lst ...)], except that, if @racket[proc]
returns @racket[#false], that element is omitted from the resulting list.
In other words, @racket[filter-map] is equivalent to
@racket[(filter (lambda (x) x) (map proc lst ...))], but more efficient,
because @racket[filter-map] avoids
building the intermediate list.
@mz-examples[#:eval list-eval