On 5/13/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
Having thought more about it, I realize what you mean and why we were
misundersanding each other.  I was thinking about array concatenation,
and you about string concatenation.  I am suggesting the default
operaion to be array concatenation rather than array cross-product as
it is now.

Yes, I realised after reading your previous post that what you mean
with multiplication and concatenation, we where using slightly
different meanings for the terms. I think we mostly understand each
other now.


On 5/11/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> On 5/11/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> > On 5/11/06, Philip Ganchev <[EMAIL PROTECTED]> wrote:
> > > On 5/10/06, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> > [...]  How would you rewrite some
> > of my above examples without multiplicate command substitution?
>
> [reordered]
> > # Loop over all users
> > for i in (cat /etc/passwd); ...; end
>
> Where is the multiplication here?  The loop iterates over lines in
> file "/etc/passwd".  This should work as currently.

The "cat /etc/passwd" would produce a list as before.  There is no
multiplication or concatenation, except the trivial multiplication
(with nothing) and the trivial concatenation.

> > # Remove a sequence of files
> > rm img(seq 4 39).jpg
>
> If brace expansion uses whitespace separators,
>
>     rm img{(seq 4 39)}.jpg

The "seq 4 39" produces a list.  The {} multiplies this list to the
lists containing one element each, "img" and ".jpg".  The result is a
list whose first element is "img4.jpg", etc.

> > # Print information about select files
> > ll (find . -type ...)
>
> Where is the multiplication here?  The command substitution outputs a
> list of filenames and "ll" uses it as input.  This would work as
> currently.

Again, no multiplication or concatenation except the trivial ones.

This is an alternative to the expansion mechanism proposed by Beni
(see my reply to his post).

String concatenation can be achieved as "$arr2".


What you are suggesting is essentially a different parameter expanson
paradigm than the one I have designed into fish. The underlying
concept in my expansion design is that everything is treated as an
outer product. Using this design, I can express almost every type of
operation that I often use in a way that is terse but very powerful.

You are suggesting that a totally different paradigm might be better.
I think that with Bens suggestion of how to use brace expansion, the
concatenation paradigm will work. I am going to have to spend a chunk
of time here to think through what corner cases exist with it and it
it actually allows you to perform common operations with simpler
statements.

You said before that you think concatenation is more often useful, but
I can see two large classes of operations where an outer product is
what you want, namely array slicing and operations like 'rm image_(seq
12 49).jpg'. Both of these (to me) very common operations would
suddenly also require a bracket. This is not a major problem in
itself, but in _my_ experience, the outer product behaviour is more
often what you want, since the above two examples are used very
frequently by me. I haven't seen any examples of when string
concatenation is what you want. Could you give me some examples of
common operations where concatenation gives you a better syntax?

--
Axel


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to