From 3fa6622ee84828de3c5652507c116dd8a12b3744 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 19 Feb 2022 12:10:12 +0300 Subject: [PATCH] doc: simplify the `filter/map` example a bit --- doc/docs.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 1f4a20a88b..d545926d99 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -1174,10 +1174,8 @@ the `it` built-in variable to achieve a classic `map/filter` functional paradigm ```v // using filter, map and negatives array slices -a := ['pippo.jpg', '01.bmp', '_v.txt', 'img_02.jpg', 'img_01.JPG'] -res := a.filter(it#[-4..].to_lower() == '.jpg').map(fn (w string) string { - return w.to_upper() -}) +files := ['pippo.jpg', '01.bmp', '_v.txt', 'img_02.jpg', 'img_01.JPG'] +filtered := files.filter(it#[-4..].to_lower() == '.jpg').map(it.to_upper()) // ['PIPPO.JPG', 'IMG_02.JPG', 'IMG_01.JPG'] ```