cleanup, docs

This commit is contained in:
root
2026-06-16 12:21:31 +00:00
parent dff1959341
commit ea08d5f28b
296 changed files with 1571 additions and 1940 deletions
+4 -9
View File
@@ -1,6 +1,3 @@
:title
map
:sig
StringList map(StringList items, function<String (String)> f)
vector<R> map(vector<T> items, function<R (T)> f)
@@ -19,13 +16,11 @@ filter
:content
Returns a new list by calling `f` for each item in `items`.
```cpp
auto upper = map(names, [](String s) { return(to_upper(s)); });
```
Use `filter()` when you want to keep only matching items, and `map()` when you want to transform each item.
## Related Concepts
- JavaScript / React: `Array.prototype.map()`
- PHP: `array_map()`
:example
StringList names = split("ada,grace", ",");
StringList upper = map(names, [](String item) { return(to_upper(item)); });
print(join(upper, ","), "\n");