Skip to content

two nested loops output doesn't meet expectation #632

Answered by cueckoo
cueckoo asked this question in Q&A
Discussion options

You must be logged in to vote

Original reply by @verdverm in cuelang/cue#632 (comment)

You have nested list comprehensions, so the list of lists is expected.

What you want to add is a list.FlattenN([[]], 1) around your nested list comp.

https://pkg.go.dev/cuelang.org/[email protected]/pkg/list#FlattenN

Replies: 2 comments 3 replies

Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
1 reply
@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

Answer selected by cueckoo
Comment options

cueckoo
Jul 3, 2021
Collaborator Author

You must be logged in to vote
2 replies
@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

@cueckoo
Comment options

cueckoo Jul 3, 2021
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant