Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Looking for devious one or two liner solutions to a problem
- X-seq: zsh-users 11984
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Kenneth Lareau <elessar@xxxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Subject: Re: Looking for devious one or two liner solutions to a problem
- Date: Wed, 10 Oct 2007 20:42:56 -0700
- In-reply-to: <071010203509.ZM28474@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071010163733.7875cee3.elessar@xxxxxxxxxxx> <071010203509.ZM28474@xxxxxxxxxxxxxxxxxxxxxx>
On Oct 10, 8:35pm, Bart Schaefer wrote:
}
} And if you return the new version in $a (since you've already made it
} non-local) and therefore don't bother printing it, 71 characters:
}
} f(){a=(${(s:.:)1});a[$2,3]=($[${a[$2]}+1] 0 0 0);a=${(j:.:)${a[0,3]}}}
Hmm, I may have just found a parser bug. That doesn't work; you need
one more space or sem between the assignment and the closing brace:
f(){a=(${(s:.:)1});a[$2,3]=($[${a[$2]}+1] 0 0 0);a=${(j:.:)${a[0,3]}};}
Afterthought: Of course the next interview question is to show them
a string like that and ask "What does this do?"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author