google / google/xls

An array should be an iterable expression

Open
#313 1 comment 0 reactions 0 assignees View on GitHub
dslx enhancement
Dominant language
C++
Stars
1.9k
Forks
283
Avg merge
2d 10h
Merged PRs (30d)
135

Description

Right now, only `range` and `enumerate` produce an iterable expression (according to the DSLX reference). An array should also produce an iterable expression. We would have this blueprint:
```
for (array_value, accumulator): (type-of-element_of_some_array, type-of-accumulator) in some_array {
body-expression
} (initial-accumulator-value)
```

I assume this could build on the existing support for `enumerate`, and discard the part that produces the indices of the array.

----

Extension: bit slices also strike me as something iterable (but for now, I'm more in need of the array support).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.