Re: Fun and games with lambda

2011-06-17 Thread Lalitha Prasad K
I would rate it as a great example of human ingenuity Lalit On Fri, Jun 17, 2011 at 9:40 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > If you've ever wondered what lambda and reduce are good for, run this one- > liner and wonder no more... > > (Be patient, it may take a fe

Re: Fun and games with lambda

2011-06-17 Thread Chris Angelico
On Sat, Jun 18, 2011 at 2:10 AM, Steven D'Aprano wrote: > If you've ever wondered what lambda and reduce are good for, run this one- > liner and wonder no more... > > (Be patient, it may take a few seconds to return.) I have a decent CPU so it's not too bad. And the precision produced is notewort

Re: Fun and games with lambda

2011-06-17 Thread Mark Dickinson
On Jun 17, 5:10 pm, Steven D'Aprano wrote: > > print((lambda f:((lambda p:p[0]+'.'+p[1:])(str((lambda Q:2*Q[0]*Q[0]//Q > [3])((lambda F:(lambda S:f(lambda T,_:((T[0]+T[1])//2,S((T[0]*T[1])// > F),2*T[2],(T[3]-(T[2]*(((T[0]+T[1])//2)**2-(S((T[0]*T[1])//F))**2))//F)), > [0]*13,(F,(F*F)//S(2*F),2,F//

Re: Fun and games with lambda

2011-06-17 Thread Ian Kelly
On Fri, Jun 17, 2011 at 10:56 AM, Wolfgang Rohdewald wrote: > On Freitag 17 Juni 2011, Steven D'Aprano wrote: >> run this one- >> liner and wonder no more... > > looks like something dangerous to me. What does > it do? rm -rf ? The thread at the link discusses what it does in great detail. -- ht

Re: Fun and games with lambda

2011-06-17 Thread Wolfgang Rohdewald
On Freitag 17 Juni 2011, Steven D'Aprano wrote: > run this one- > liner and wonder no more... looks like something dangerous to me. What does it do? rm -rf ? -- Wolfgang -- http://mail.python.org/mailman/listinfo/python-list

Fun and games with lambda

2011-06-17 Thread Steven D'Aprano
If you've ever wondered what lambda and reduce are good for, run this one- liner and wonder no more... (Be patient, it may take a few seconds to return.) # Python 2 version: print((lambda f:((lambda p:p[0]+'.'+p[1:])(str((lambda Q:2*Q[0]*Q[0]//Q [3])((lambda F:(lambda S:f(lambda T,_:((T[0]+T[1])