Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.maple > #892

Re: Merging two lists

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Axel Vogt <&noreply@axelvogt.de>
Newsgroups comp.soft-sys.math.maple
Subject Re: Merging two lists
Date Sun, 15 Jun 2014 19:56:54 +0200
Lines 21
Message-ID <c0653qFaeruU1@mid.individual.net> (permalink)
References <lnj4fm$mon$1@news.albasani.net>
Reply-To &noreply@axelvogt.de
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net uKT6mLT5H7n9H1csqHGz1wRf4iVZ0mRzZHQ/G7eArBhN7+ar4=
Cancel-Lock sha1:bRVtDBDB2lb1xFiXrsyru81U0uA=
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0
In-Reply-To <lnj4fm$mon$1@news.albasani.net>
Xref csiph.com comp.soft-sys.math.maple:892

Show key headers only | View raw


On 15.06.2014 05:38, none Rouben Rostamian wrote:
> Let's say I have the following two lists:
> M := [a,b,c,d];
> N := [e,f,g,h];
>
> I want to create a list of pairs, as in:
> [[a, e], [b, f], [c, g], [d, h]]
>
> Here is how I do it:
> [seq([M[i],N[i]], i=1..nops(M))];
>
> but that's too pedestrian.  Is there a neater and more elegant
> way of doing this?
>

 From the help for 'zip':

   zip(`[]`,M ,N);
                    [[a, e], [b, f], [c, g], [d, h]]

where I find pedestrian's way much more clear.

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Merging two lists rouben@shadow.(none) (Rouben Rostamian) - 2014-06-15 03:38 +0000
  Re: Merging two lists Axel Vogt <&noreply@axelvogt.de> - 2014-06-15 19:56 +0200
    Re: Merging two lists Rainer Rosenthal <r.rosenthal@web.de> - 2014-06-16 00:27 +0200
      Re: Merging two lists rouben@shadow.(none) (Rouben Rostamian) - 2014-06-16 20:17 +0000
  Re: Merging two lists Joe Riel <joer@san.rr.com> - 2014-06-15 10:58 -0700
    Re: Merging two lists Joe Riel <joer@san.rr.com> - 2014-06-15 11:02 -0700

csiph-web