Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What's the reasoning behind z & s returning nular for empty input?
- X-seq: zsh-users 24417
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: What's the reasoning behind z & s returning nular for empty input?
- Date: Sat, 9 Nov 2019 10:09:44 +0100
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=O0Wn9OzvnhexHsZJB2AxCpiXFIlkWPAdJHQmRfPPMKk=; b=JBI6yDqfBo+jUfKgyqPrspaSyaVZjd/VS481K3WfQgO/QUH13zXvrQMmFTKojXNgqj ZEKn3+WQXmxyQTt1r7US73LzBbMISG0WhjasYEHIDzVYYenh8l04MCMDGJqHhaMHD2A+ SjOvhR3c7tOCWTedz4AKZn3QiLfFndUICcf3uBJRID0s/qloHMH4z0zhQlndbUD2kYic VxnwDBuMVbN+LUU31l01sv6xZtbC+r0iCiKEozUE9hPbsDFCGJOPjy40X6GctMxDIYaM XE3JoGkiubeSuWZTWVq42/64ct2nxu+CRKSWqD0Z9mGW5rdOXD/x3dR0/nddMFMWHOWJ 5gfQ==
- In-reply-to: <CAN=4vMriuV_u+LpOJDjRLtrE94h5hEXgrQXtVH-cpBg+kRCh-w@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVCD7e=vATDBc7px1d4XNYiKu1=2iZP9YaJ5PutgsDTsoQ@mail.gmail.com> <CAN=4vMpj91iZzOgLNNcUzb4UuTDEAiFxkjyuAa76hqqaQjnFBg@mail.gmail.com> <CAKc7PVCArzvg+Tmqwo7xQwYjBSz8sEnJwYPjZ=T0BETHsYsjXQ@mail.gmail.com> <CAN=4vMpOPy_kecd_EweP7OL5RJUpBNbfAcJUtYxbHPZZq0UV-g@mail.gmail.com> <CAKc7PVBi-9aS18pTN7t7iYz2F6Voj8hTu9bDB5NAHSSquwCwew@mail.gmail.com> <CAN=4vMriuV_u+LpOJDjRLtrE94h5hEXgrQXtVH-cpBg+kRCh-w@mail.gmail.com>
On Sat, 9 Nov 2019 at 09:52, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Sat, Nov 9, 2019 at 9:40 AM Sebastian Gniazdowski
> <sgniazdowski@xxxxxxxxx> wrote:
> > Yes, I was also referring to this fragment, however it states that the
> > empty elements should be removed, and even – that they should be
> > removed more eagerly, so I still wonder why produce a nular for an
> > empty input?
>
> Oh, I see what you mean. Apparently, only inner empty elements are
> dropped by "${(s...)...}" while the first and the last are retained.
>
> "${(s:,:):-a,,b}" => (a b)
> "${(s:,:):-,,}" => ('' '')
>
> Looks like it's either a bug in the code or in the documentation.
True, I wasn't fully aware of that:
array=( "${(s:,:):-,,}" )
print -r ${(q)array}
Output:'' ''
array=( "${(s:,:):-,}" )
print -r ${(q)array}
Output:'' ''
I think that the documentation or the behavior should be updated.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author