zsh-users
 help / color / mirror / code / Atom feed
From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: zsh-users@math.gatech.edu
Subject: Re: cross-product array function?
Date: Tue, 3 Feb 1998 17:39:59 -0500	[thread overview]
Message-ID: <19980203173959.11960@astaroth.nit.gwu.edu> (raw)
In-Reply-To: <Pine.SOL.3.96.980203155605.1958A-100000@start>

On Tue, Feb 03, 1998 at 03:59:44PM -0500, Nate Johnston wrote:
> On Tue, 3 Feb 1998, Andrew Main wrote:
> 
> #foo=(first second third)
> #bar=(word person base)
> #echo $^foo$^bar
> 
> I attempted this, and I had an odd result on the first element of the
> first array.  Is this broken in the version I use?
> 
> natej:~> ONE=(1 2 3)
> natej:~> TWO=(A B C)
> natej:~> echo $^ONE$^TWO
> 1C 2A 2B 2C 3A 3B 3C
> 
> zsh: 3.0.0

	i get this behaviour too, with 3.1.2.
	
	even stranger is what happens with more than two items variables being 
expanded; the behaviour is the same if i use the $^ shortcut.  i was expecting 
the output to be
	
1AZ 1BX 1BY 1BZ 1CX 1CY 1CZ 2AX 2AY 2AZ 2BX 2BY 2BZ 2CX 2CY 2CZ 3AX 3AY 3AZ 3BX 
3BY 3BZ 3CX 3CY 3CZ

	, where all of the elements of the first expansion were lost but the 
last one, or perhaps

1CZ 2AX 2AY 2AZ 2BX 2BY 2BZ 2CX 2CY 2CZ 3AX 3AY 3AZ 3BX 3BY 3BZ 3CX 3CY 3CZ

	(depending on if the expansion were recursive or not).  if everything 
were working okay, i would have expected

1AX 1AY 1AZ 1BX 1BY 1BZ 1CX 1CY 1CZ 2AX 2AY 2AZ 2BX 2BY 2BZ 2CX 2CY 2CZ 3AX 3AY 
3AZ 3BX 3BY 3BZ 3CX 3CY 3CZ

	but instead, there is this very strange output:

$ foo=(1 2 3)
$ bar=(A B C)
$ mug=(X Y Z)
$ setopt rcexpandparam
$ echo ${foo}${bar}${mug}
1CZ 2AZ 2BX 2BY 2BZ 2CX 2CY 2CZ 3AZ 3BX 3BY 3BZ 3CX 3CY 3CZ

	is this a bug? feature? gross network error somewhere between the chair 
and the keyboard?
	
-- 
"Countin' on a remedy I've counted on before
Goin' with a cure that's never failed me
What you call the disease
I call the remedy"  -- The Mighty Mighty Bosstones


  reply	other threads:[~1998-02-03 22:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-03 19:08 Sweth Chandramouli
1998-02-03 19:26 ` Andrew Main
1998-02-03 19:51   ` Sweth Chandramouli
1998-02-03 20:00     ` Andrew Main
1998-02-03 20:59   ` Nate Johnston
1998-02-03 22:39     ` Sweth Chandramouli [this message]
1998-02-03 22:45     ` Thomas Köhler
1998-02-04  9:29     ` Andrew Main

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980203173959.11960@astaroth.nit.gwu.edu \
    --to=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).