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:
parent
4d032bdd64
commit
4362e98b58
|
@ -1235,7 +1235,11 @@ key value from each list element, so two items are considered equal if
|
||||||
@defproc[(filter-map [proc procedure?] [lst list?] ...+)
|
@defproc[(filter-map [proc procedure?] [lst list?] ...+)
|
||||||
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.
|
building the intermediate list.
|
||||||
|
|
||||||
@mz-examples[#:eval list-eval
|
@mz-examples[#:eval list-eval
|
||||||
|
|
Loading…
Reference in New Issue
Block a user