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
+9 -5
View File
@@ -6,6 +6,7 @@ f : mapper called for each iterated item
return value : mapped copy
:see
>types
0_DValue
2_DValue_each
2_DValue_filter
@@ -13,8 +14,11 @@ return value : mapped copy
:content
Builds a new `DValue` by replacing each iterated child with the mapper's returned value. List-shaped input stays list-shaped and is re-indexed by `push()`. Map-shaped input preserves keys. Scalar input is mapped once and pushed into a list.
```cpp
DValue labels = rows.map([](const DValue& row, String) {
DValue out; out = row.get_by_path("label").to_string(); return(out);
});
```
:example
DValue names;
DValue first; first = "ada";
DValue second; second = "grace";
names.push(first);
names.push(second);
DValue upper = names.map([](const DValue& item, String key) { DValue out; out = to_upper(item.to_string()); return(out); });
print(upper["0"].to_string(), ",", upper["1"].to_string(), "\n");