Re: generalized foldlist problem

*To*: mathgroup at smc.vnet.net*Subject*: [mg69089] Re: generalized foldlist problem*From*: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>*Date*: Wed, 30 Aug 2006 06:32:18 -0400 (EDT)*Organization*: Uni Leipzig*References*: <ed0rja$sll$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, either your explantion or your example is nonsense, but here is a version that does this what your explanation say Plus @@@ Transpose[ PadRight[#, Max[list2]] & /@ MapThread[Table[#1, {#2}] &, {list1, list2}]] {a + b + c + d + e, a + b + c + e, a + c + e, c + e, c + e, e} Regards Jens "Arkadiusz Majka" <Arkadiusz.Majka at telekomunikacja.pl> schrieb im Newsbeitrag news:ed0rja$sll$1 at smc.vnet.net... | DearAll, | | Please, help! | | I have two list | | list1={a,b,c,d,e} | list2={3,2,5,1,6} | | and I want to apply a modified version of FoldList to list1 in the | following way: list2 indicates that element a appears only 3 times (if | space enough) beginning from the beginning of the list , element b | appears 2 times, c - 5 times , etc. | | So the output should be | | GeneralizedFoldList[list1,list2]={a,a+b,a+b+c,c+d,c+e} | | Thanks for any hints, | | arek |