From 4c04d4afce9b71e856f4a2122770e29765d0d071 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Fri, 1 Jan 2016 12:44:12 -0600 Subject: [PATCH] Fix discussion of filter. Closes PR 15083. --- pkgs/racket-doc/scribblings/guide/lists.scrbl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkgs/racket-doc/scribblings/guide/lists.scrbl b/pkgs/racket-doc/scribblings/guide/lists.scrbl index c7bb8f1bac..663031eadc 100644 --- a/pkgs/racket-doc/scribblings/guide/lists.scrbl +++ b/pkgs/racket-doc/scribblings/guide/lists.scrbl @@ -74,15 +74,7 @@ by @racket[and]ing or @racket[or]ing: (ormap number? (list "a" "b" 6)) ] -The @racket[filter] function keeps elements for which the body result -is true, and discards elements for which it is @racket[#f]: - -@interaction[ -(filter string? (list "a" "b" 6)) -(filter positive? (list 1 -2 6 7 0)) -] - -The @racket[map], @racket[andmap], @racket[ormap], and @racket[filter] +The @racket[map], @racket[andmap], and @racket[ormap] functions can all handle multiple lists, instead of just a single list. The lists must all have the same length, and the given function must accept one argument for each list: @@ -93,6 +85,14 @@ must accept one argument for each list: (list 6 3 7)) ] +The @racket[filter] function keeps elements for which the body result +is true, and discards elements for which it is @racket[#f]: + +@interaction[ +(filter string? (list "a" "b" 6)) +(filter positive? (list 1 -2 6 7 0)) +] + The @racket[foldl] function generalizes some iteration functions. It uses the per-element function to both process an element and combine it with the ``current'' value, so the per-element function takes an