[FRPythoneers] Joining a lists of lists?

Rob Riggs rob at pangalactic.org
Thu Aug 8 11:39:46 MDT 2002


Sorry -- got some weird characters when doing format conversion. The 
expression should read:

reduce(lambda x, y: x + y, [[1,2,3],[4,5,6],[7,8,9]])

Rob Riggs wrote:

> |reduce(lambda x, y: x + y, |[[1,2,3],[4,5,6],[7,8,9]])
>
>
> marciot wrote:
>
>> Hi,
>>
>> I was looking for an easy way to convert a list of lists into a 
>> flattened
>> list:
>>
>>  
>>
>>>>> a = somefunc([[1,2,3],[4,5,6],[7,8,9]])
>>>>> print a
>>>>>       
>>>>
>> [1,2,3,4,5,6]
>>
>> In scheme, I would have written:
>>
>>   (apply #'append '((1 2 3) (4 5 6) (7 8 9))).
>>
>> What's the equivalent expression in Pythonese?
>>
>> While I'm at it, is there any good online reference that shows python 
>> equivalents for common Scheme/LISP expressions?
>>
>> Marcio Luis Teixeira
>>
>>
>> _______________________________________________
>> This message sent by the FRPythoneers mailing list.
>> Unsubscribe: echo unsubscribe | 
>> FRPythoneers-request at lists.community.tummy.com
>> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
>>  
>>
>
>
>
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | 
> FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers







More information about the FRPythoneers mailing list