On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly <ian.g.ke...@gmail.com> wrote:
> On Fri, Oct 5, 2012 at 2:19 PM, vasudevram <vasudev...@gmail.com> wrote:
>>
>> http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html
>
> Your fmap is a special case of reduce.

So is map.

def map(f, seq):
    return reduce(
        lambda rseq, newpre:
            rseq.append(f(newpre)) or rseq,
        seq,
        [])

"X is a special case of reduce" is basically the same as saying "X can
be implemented using a for loop". If it's meant as a complaint, it's a
poor one.

-- Devin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to