Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.maple > #892
| From | Axel Vogt <&noreply@axelvogt.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.maple |
| Subject | Re: Merging two lists |
| Date | 2014-06-15 19:56 +0200 |
| Message-ID | <c0653qFaeruU1@mid.individual.net> (permalink) |
| References | <lnj4fm$mon$1@news.albasani.net> |
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 | Next — Previous in thread | Next in thread | Find similar
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