Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Rosenthal Newsgroups: comp.soft-sys.math.maple Subject: Re: Merging two lists Date: Mon, 16 Jun 2014 00:27:33 +0200 Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Trace: individual.net n2l9yfb0aGAcEeqskUEQ6wopY8iTHC28S4cdouwf7G2RE8Gdc= Cancel-Lock: sha1:Nl4IV0avxPROAs8N74FhN6BvWyA= User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: Xref: csiph.com comp.soft-sys.math.maple:895 Am 15.06.2014 19:56, schrieb Axel Vogt: > 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. > Maple V doesn't have it that short, but zip works as follows: zip((x,y)->[x,y],M ,N); I did not know "zip" until now. Thanks for telling. Cheers, Rainer