You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for (auto x : reversed(list(1,2,3))) { print(x); }
90
+
// Not supported for pythonic::vars::var or list. Use slicing with negative step for reverse iteration:
91
+
for (auto x : list(1,2,3).slice(var(), var(), -1)) { print(x); } // 3 2 1
90
92
91
93
// --- Loop Macros ---
92
94
for_each(x, list(1,2,3)) { print(x); }
@@ -107,7 +109,7 @@ print(all(list(1,1,1)));
107
109
108
110
## Notes
109
111
110
-
- All iteration helpers work with standard containers, Pythonic containers, and C++20 ranges.
112
+
- All iteration helpers work with standard containers, Pythonic containers, and C++20 ranges, except reverse iteration for pythonic::vars::var/list (use .slice with negative step instead). -**Negative indices and negative step are supported in pythonic::vars::var/list slicing:** - `lst[-1]` gives the last element, `lst.slice(var(), var(), -1)` reverses the list, etc.
111
113
- Loop macros provide Python-like syntax for common iteration patterns.
112
114
- Views are lazy and efficient; use them for large data or pipelines.
113
115
- Utility functions operate on any iterable, including ranges and views.
// - enumerate and for_enumerate macro are not safe for dynamic containers (pythonic::vars::var/list). Consider a class-based or type-trait-based solution for future.
20
+
// - reverse_view and reversed are not supported for pythonic::vars::var/list. Consider adding bidirectional iterator support or a custom reverse adaptor for dynamic containers.
21
+
// - Refactor all loop macros (for_each, for_index, for_enumerate, etc.) to class-based or constexpr function-based implementations for better type safety and IDE support.
0 commit comments