Re: [Tutor] Writing the Map function as a oneliner

2011-11-07 Thread Alan Gauld
On 07/11/11 23:32, Rafael Turner wrote: Hello, I am trying to write the map function as a oneliner But I would like to make recursive version. Here is what I was thinking: I can write map as def pyMap(F,li): if li == []: return [] else: return [F(li[0])] + map2(

[Tutor] Writing the Map function as a oneliner

2011-11-07 Thread Rafael Turner
Hello, I am trying to write the map function as a oneliner. I currently have implement map as a list comprehension: map = lambda F,li: [F(x) for x in li] But I would like to make recursive version. Here is what I was thinking: I can write map as def pyMap(F,li): if li == []: return