Re: fmap(), "inverse" of Python map() function

2012-10-06 Thread vasudevram
> Thanks to all who replied. Always good to learn something new. P.S. A reader posted a good comment with Scala as well as Python code for a compose function (basically same functionality as fmap, or more - the compose once, run many times thing). It's the 4th comment on my blog post. - Vasud

Re: fmap(), "inverse" of Python map() function

2012-10-06 Thread vasudevram
On Saturday, October 6, 2012 5:01:40 AM UTC+5:30, Devin Jeanpierre wrote: > On Fri, Oct 5, 2012 at 7:24 PM, Ian Kelly wrote: > > > I realize that. My point is that the function *feels* more like a > > > variant of reduce than of map. > > > > > >> If it's meant as a complaint, it's a poor one.

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 7:24 PM, Ian Kelly wrote: > I realize that. My point is that the function *feels* more like a > variant of reduce than of map. > >> If it's meant as a complaint, it's a poor one. > > It's not. Fair enough all around. Sorry for misunderstanding. -- Devin -- http://mail.py

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 4:52 PM, Devin Jeanpierre wrote: > On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly wrote: >> On Fri, Oct 5, 2012 at 2:19 PM, vasudevram wrote: >>> >>> http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html >> >> Your fmap is a special case of reduce. > > So i

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly wrote: > On Fri, Oct 5, 2012 at 2:19 PM, vasudevram 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, ne

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 3:31 PM, Ian Kelly wrote: > On Fri, Oct 5, 2012 at 2:19 PM, vasudevram wrote: >> >> http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html > > Your fmap is a special case of reduce. > > def fmap(functions, argument): > return reduce(lambda result, fu

Re: fmap(), "inverse" of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 2:19 PM, vasudevram wrote: > > http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html Your fmap is a special case of reduce. def fmap(functions, argument): return reduce(lambda result, func: func(result), functions, argument) -- http://mail.python.

fmap(), "inverse" of Python map() function

2012-10-05 Thread vasudevram
http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html - Vasudev Ram www.dancingbison.com jugad2.blogspot.com twitter.com/vasudevram -- http://mail.python.org/mailman/listinfo/python-list