Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should permit iterating a List without declaring a binding #566

Closed
michaelficarra opened this issue Dec 13, 2023 · 6 comments · Fixed by #567
Closed

should permit iterating a List without declaring a binding #566

michaelficarra opened this issue Dec 13, 2023 · 6 comments · Fixed by #567

Comments

@michaelficarra
Copy link
Member

I want to be able to iterate a List using the For each element _e_ of _list_, do notation without having to declare an unused binding (essentially, repeat this a number of times equal to the number of elements in the list). I would write this as For each element of _list_, do, but ecmarkup currently thinks that declares _list_ instead of referencing it.

@ljharb
Copy link
Member

ljharb commented Dec 13, 2023

Why not a loop from 0 to list.length?

@michaelficarra
Copy link
Member Author

It's not as direct.

@bakkot
Copy link
Contributor

bakkot commented Dec 13, 2023

I also prefer a loop from 0 to the length of the list, and so am not going to implement this.

@michaelficarra
Copy link
Member Author

michaelficarra commented Dec 14, 2023

We talked about this in editor call and are going to explore using Repeat _n_ times: as an alternative.

@michaelficarra
Copy link
Member Author

michaelficarra commented Dec 14, 2023

I get this error when using the suggested form:

Error: spec.emu:47:14: expected "Repeat" to start with "Repeat, while " or "Repeat, until "
Error: spec.emu:47:39: expected "Repeat" to end with ","

@bakkot
Copy link
Contributor

bakkot commented Dec 14, 2023

#567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants