Re: Functional Programming and python

2013-10-01 Thread Piet van Oostrum
Antoon Pardon writes: > Op 30-09-13 20:55, Piet van Oostrum schreef: >> Franck Ditter writes: >> >>> Good approach of FP in Python, but two points make me crazy : >>> 1. Tail recursion is not optimized. We are in 2013, why ? This is known >>> technology (since 1960). >>> And don't answer with "

Re: Functional Programming and python

2013-10-01 Thread Neil Cerutti
On 2013-10-01, Steven D'Aprano wrote: > On Mon, 30 Sep 2013 18:36:28 +, Neil Cerutti quoted: > >> Why can??t lambda forms contain statements? > > Gah! Please fix your news client! (I see you're using slrn.) > The \x92 bytes found in your message are apostrophes > (technically: right single

Re: Functional Programming and python

2013-10-01 Thread Chris Angelico
On Tue, Oct 1, 2013 at 11:36 AM, rusi wrote: >> (But I do sometimes yearn for a goto.) > > Ha! In Scheme, a tail call IS a goto with parameter re-assignment Precisely. In fact, tail call optimization basically consists of that exact rewrite. I'm absolutely fine with it being completely explicit.

Re: Functional Programming and python

2013-09-30 Thread rusi
On Tuesday, October 1, 2013 6:11:18 AM UTC+5:30, Steven D'Aprano wrote: > On Mon, 30 Sep 2013 19:04:32 +0200, Franck Ditter wrote: > > 2. Lambda-expression body is limited to one expression. Why ? > > Nobody has come up with syntax that is unambiguous, would allow multiple > statements in an expr

Re: Functional Programming and python

2013-09-30 Thread alex23
On 1/10/2013 3:04 AM, Franck Ditter wrote: 1. Tail recursion is not optimized. We are in 2013, why ? This is known technology (since 1960). And don't answer with "good programmers don't use recursion", this is bullshit. Here's an article Guido wrote explaining his reasoning: http://neopythonic

Re: Functional Programming and python

2013-09-30 Thread Terry Reedy
On 9/30/2013 5:02 PM, Tim Chase wrote: On 2013-09-30 19:04, Franck Ditter wrote: two points make me crazy : 1. Tail recursion is not optimized. We are in 2013, why ? This is known technology (since 1960). And don't answer with "good programmers don't use recursion", I seem to recall hearing th

Re: Functional Programming and python

2013-09-30 Thread Steven D'Aprano
On Mon, 30 Sep 2013 19:04:32 +0200, Franck Ditter wrote: > Good approach of FP in Python, but two points make me crazy : 1. Tail > recursion is not optimized. We are in 2013, why ? This is known > technology (since 1960). And don't answer with "good programmers don't > use recursion", this is bull

Re: Functional Programming and python

2013-09-30 Thread Steven D'Aprano
On Mon, 30 Sep 2013 18:36:28 +, Neil Cerutti quoted: > Why can’t lambda forms contain statements? Gah! Please fix your news client! (I see you're using slrn.) The \x92 bytes found in your message are apostrophes (technically: right single quotation marks), encoded using the legacy Windo

Re: Functional Programming and python

2013-09-30 Thread Tim Chase
On 2013-09-30 19:04, Franck Ditter wrote: > two points make me crazy : > 1. Tail recursion is not optimized. We are in 2013, why ? This is > known technology (since 1960). And don't answer with "good > programmers don't use recursion", I seem to recall hearing that the primary reason it hadn't bee

Re: Functional Programming and python

2013-09-30 Thread Antoon Pardon
Op 30-09-13 20:55, Piet van Oostrum schreef: Franck Ditter writes: Good approach of FP in Python, but two points make me crazy : 1. Tail recursion is not optimized. We are in 2013, why ? This is known technology (since 1960). And don't answer with "good programmers don't use recursion", this

Re: Functional Programming and python

2013-09-30 Thread Antoon Pardon
Op 30-09-13 19:04, Franck Ditter schreef: Good approach of FP in Python, but two points make me crazy : 1. Tail recursion is not optimized. We are in 2013, why ? This is known technology (since 1960). And don't answer with "good programmers don't use recursion", this is bullshit. Guido doesn

Re: Functional Programming and python

2013-09-30 Thread Piet van Oostrum
Franck Ditter writes: > Good approach of FP in Python, but two points make me crazy : > 1. Tail recursion is not optimized. We are in 2013, why ? This is known > technology (since 1960). > And don't answer with "good programmers don't use recursion", this is > bullshit. Tail recursion optimiza

Re: Functional Programming and python

2013-09-30 Thread Neil Cerutti
On 2013-09-30, Franck Ditter wrote: > In article , > rusi wrote: >> I touched upon these in two blog-posts: >> 1. http://blog.languager.org/2013/06/functional-programming-invades.html >> 2. http://blog.languager.org/2012/10/functional-programming-lost-booty.html >> >> Also most programmers with

Re: Functional Programming and python

2013-09-30 Thread Chris Angelico
On Tue, Oct 1, 2013 at 3:04 AM, Franck Ditter wrote: > 1. Tail recursion is not optimized. We are in 2013, why ? This is known > technology (since 1960). > And don't answer with "good programmers don't use recursion", this is > bullshit. I've yet to see any value in having the compiler/interpre

Re: Functional Programming and python

2013-09-30 Thread Franck Ditter
In article , rusi wrote: > Combining your two questions -- Recently: > What minimum should a person know before saying "I know Python" > > And earlier this > On Sunday, August 4, 2013 10:00:35 PM UTC+5:30, Aseem Bansal wrote: > > If there is an issue in place for improving the lambda forms then

Re: Functional Programming and python

2013-09-24 Thread rusi
On Tuesday, September 24, 2013 8:56:21 PM UTC+5:30, Chris Angelico wrote: > On Wed, Sep 25, 2013 at 1:07 AM, rusi wrote: > > And this is an old conundrum in programming language design: > > > > In C printf is easy to write and NOT put into the language but into > > external libraries > > > In Pa

Re: Functional Programming and python

2013-09-24 Thread Chris Angelico
On Wed, Sep 25, 2013 at 1:07 AM, rusi wrote: > And this is an old conundrum in programming language design: > > In C printf is easy to write and NOT put into the language but into external > libraries > In Pascal, writeln cannot be outside the language because as a user defined > function, its t

Re: Functional Programming and python

2013-09-24 Thread rusi
On Tuesday, September 24, 2013 8:21:19 PM UTC+5:30, Jussi Piitulainen wrote: > Would the type system get in the way of providing some analogous > function in Haskell? I don't know. Yes. The haskell curry curry f x y = f (x,y) is really only curry2 curry3 would be curry3 f x y z = f (x,y,z) and so

Re: Functional Programming and python

2013-09-24 Thread Jussi Piitulainen
rusi writes: > On Tuesday, September 24, 2013 1:12:51 PM UTC+5:30, Jussi Piitulainen wrote: > > rusi writes: > > > > > Without resorting to lambdas/new-functions: > > > With functools.partial one can freeze any subset of a > > > function(callable's) parameters. > > > > > In Haskell one can onl

Re: Functional Programming and python

2013-09-24 Thread rusi
On Tuesday, September 24, 2013 1:12:51 PM UTC+5:30, Jussi Piitulainen wrote: > rusi writes: > > > Without resorting to lambdas/new-functions: > > With functools.partial one can freeze any subset of a > > function(callable's) parameters. > > > > > In Haskell one can only freeze the first parame

Re: Functional Programming and python

2013-09-24 Thread Jussi Piitulainen
rusi writes: > Without resorting to lambdas/new-functions: > With functools.partial one can freeze any subset of a > function(callable's) parameters. > > In Haskell one can only freeze the first parameter or at most with > a right section the second You have an f of type A -> B -> C -> D -> E

Re: Functional Programming and python

2013-09-24 Thread rusi
On Monday, September 23, 2013 11:54:53 PM UTC+5:30, Vito De Tullio wrote: > rusi wrote: > > > [Not everything said there is correct; eg python supports currying better > > [than haskell which is surprising considering that Haskell's surname is > > [Curry!] > > > AFAIK python does not support cur

Re: Functional Programming and python

2013-09-24 Thread Jussi Piitulainen
Vito De Tullio writes: > rusi wrote: > > > [Not everything said there is correct; eg python supports currying > > better [than haskell which is surprising considering that > > Haskell's surname is [Curry!] > > AFAIK python does not support currying at all (if not via some > decorators or somethi

Re: Functional Programming and python

2013-09-23 Thread Vito De Tullio
rusi wrote: > [Not everything said there is correct; eg python supports currying better > [than haskell which is surprising considering that Haskell's surname is > [Curry!] AFAIK python does not support currying at all (if not via some decorators or something like that). Instead every function