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

Missing expand? #8

Open
tesujimath opened this issue Dec 30, 2024 · 1 comment
Open

Missing expand? #8

tesujimath opened this issue Dec 30, 2024 · 1 comment

Comments

@tesujimath
Copy link

I may have overlooked it, but something I might call expand, or non-recursive flatten seems to be missing.

What I'm after is this:

> put [1 2 3 [4 5] [6 7]] | for item (all) { put $item }
▶ 1
▶ 2
▶ 3
▶ [4 5]
▶ [6 7]

which differs from flatten:

> put [1 2 3 [4 5] [6 7]] | b:flatten (one)
▶ 1
▶ 2
▶ 3
▶ 4
▶ 5
▶ 6
▶ 7

Is this of interest to you for this library?

@laodzu
Copy link
Contributor

laodzu commented Jan 8, 2025

I think what you are after is "exploding" a list as is done by the builtin $@ reference syntax:

>  var li = [1 2 3 [4 5] [6 7]]
> put $li
▶ [1 2 3 [4 5] [6 7]]
> put $@li
▶ 1
▶ 2
▶ 3
▶ [4 5]
▶ [6 7]
> 

I do not know how to call this on an "immediate list", but if we add a new name, why not use explode to stay in sync with the main elvish code?

https://elv.sh/ref/language.html#variable-use

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

No branches or pull requests

2 participants