Re: Functional programming

2014-03-05 Thread Antoon Pardon
Op 04-03-14 12:47, Steven D'Aprano schreef: On Tue, 04 Mar 2014 11:56:07 +0100, Antoon Pardon wrote: Op 04-03-14 09:56, Steven D'Aprano schreef: If you explicitly say that this is an int, then yes, that should be disallowed; It's that explicitly part that doesn't follow. Having to manage

Re: Functional programming

2014-03-05 Thread Antoon Pardon
Op 04-03-14 16:18, Steven D'Aprano schreef: Depends on the type: I suppose you can draw an analogy between records or structs and classes with no methods. But I'm not talking about creating types, I'm talking about type declarations. int x=2; # 2 is an int? Who would have guessed! How

Re: Functional programming

2014-03-05 Thread BartC
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message news:5315eec0$0$29985$c3e8da3$54964...@news.astraweb.com... On Tue, 04 Mar 2014 13:30:04 +, BartC wrote: Isn't creating classes in Python similar to creating types elsewhere? Depends on the type: I suppose you can

Re: Functional programming

2014-03-05 Thread Chris Angelico
On Wed, Mar 5, 2014 at 10:28 PM, BartC b...@freeuk.com wrote: But I agree that in many cases, an initialised declaration *could* often be used to infer the likely type without too much trouble: var x=2 # integer var y=3.0 # real var z=A # probably, a C-style string pointer ('char*')

Re: Functional programming

2014-03-05 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: C++ has something very like this, with the 'auto' keyword. It's not particularly useful for the examples you give, but can be much more so when you have templates, iterators, and so on - where the exact type declaration might be a couple dozen characters of

Re: Functional programming

2014-03-04 Thread Steven D'Aprano
On Tue, 04 Mar 2014 17:04:55 +1100, Chris Angelico wrote: On Tue, Mar 4, 2014 at 4:35 PM, Steven D'Aprano st...@pearwood.info wrote: On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: x = 23 # Compiler goes: Okay, x takes ints. x += 5 # Compiler: No prob, int += int -- int x = str(x)

Re: Functional programming

2014-03-04 Thread BartC
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote in message news:5314bb96$0$29985$c3e8da3$54964...@news.astraweb.com... Think about the sort of type declarations you have to do in (say) Pascal, and consider how stupid the compiler must be: function add_one(x: integer):integer; begin

Re: Functional programming

2014-03-04 Thread Antoon Pardon
Op 04-03-14 09:56, Steven D'Aprano schreef: If you explicitly say that this is an int, then yes, that should be disallowed; It's that explicitly part that doesn't follow. Having to manage types is the most tedious, boring, annoying, *unproductive* part of languages like Java, C and

Re: Functional programming

2014-03-04 Thread Steven D'Aprano
On Tue, 04 Mar 2014 11:56:07 +0100, Antoon Pardon wrote: Op 04-03-14 09:56, Steven D'Aprano schreef: If you explicitly say that this is an int, then yes, that should be disallowed; It's that explicitly part that doesn't follow. Having to manage types is the most tedious, boring,

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Tue, Mar 4, 2014 at 10:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Not even close. I'd like to see the compiler that can work out for itself that this function is buggy: def sine_rule(side_a, side_b, angle_a): Return the angle opposite side_b. return

Re: Functional programming

2014-03-04 Thread BartC
Steven D'Aprano st...@pearwood.info wrote in message news:53159540$0$2923$c3e8da3$76491...@news.astraweb.com... It's that explicitly part that doesn't follow. Having to manage types is the most tedious, boring, annoying, *unproductive* part of languages like Java, C and Pascal. Almost always,

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 12:30 AM, BartC b...@freeuk.com wrote: But declaring variables is not just about specifying a type; it registers the name too so that misspelled names can be picked up very early rather than at runtime (and that's if you're lucky). The two are separate. I don't know of

Re: Functional programming

2014-03-04 Thread Mark Lawrence
On 04/03/2014 13:30, BartC wrote: But declaring variables is not just about specifying a type; it registers the name too so that misspelled names can be picked up very early rather than at runtime (and that's if you're lucky). I've said before that this, to me, is one of the major downsides

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 1:05 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/03/2014 13:30, BartC wrote: But declaring variables is not just about specifying a type; it registers the name too so that misspelled names can be picked up very early rather than at runtime (and that's if

OT Sine Rule [was Re: Functional programming]

2014-03-04 Thread Steven D'Aprano
On Wed, 05 Mar 2014 00:01:01 +1100, Chris Angelico wrote: On Tue, Mar 4, 2014 at 10:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Not even close. I'd like to see the compiler that can work out for itself that this function is buggy: def sine_rule(side_a, side_b,

Re: OT Sine Rule [was Re: Functional programming]

2014-03-04 Thread Tim Chase
On 2014-03-04 14:25, Steven D'Aprano wrote: Ask-me-about-versine-and-haversine-ly y'rs, More interested in a karosine, cuisine, and a limousine. ;-) -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: OT Sine Rule [was Re: Functional programming]

2014-03-04 Thread Mark Lawrence
On 04/03/2014 14:37, Tim Chase wrote: On 2014-03-04 14:25, Steven D'Aprano wrote: Ask-me-about-versine-and-haversine-ly y'rs, More interested in a karosine, cuisine, and a limousine. ;-) -tkc What do you get if you differentiate versines, haversines, karosines, cuisines and limosines?

Re: Functional programming

2014-03-04 Thread Steven D'Aprano
On Tue, 04 Mar 2014 14:05:44 +, Mark Lawrence wrote: Once a statically typed language has been compiled the programmer can head down to the pub. It compiles? Quick! Ship it! Well, that certainly explains the quality of some programs... -- Steven D'Aprano

Re: Functional programming

2014-03-04 Thread Grant Edwards
On 2014-03-03, Ben Finney ben+pyt...@benfinney.id.au wrote: Gregory Ewing greg.ew...@canterbury.ac.nz writes: Just because the compiler *can* infer the return type doesn't necessarily mean it *should*. When I was playing around with functional languages, I ended up adopting the practice of

Re: OT Sine Rule [was Re: Functional programming]

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 1:25 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The Sine Rule, or Law of Sines, tells us that the ratio of the length of a side and the sine of the angle opposite that side is constant for any triangle. That is: a/sin(A) == b/sin(B) == c/sin(C)

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 1:55 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 04 Mar 2014 14:05:44 +, Mark Lawrence wrote: Once a statically typed language has been compiled the programmer can head down to the pub. It compiles? Quick! Ship it! Well, that certainly

Re: Functional programming

2014-03-04 Thread Steven D'Aprano
On Tue, 04 Mar 2014 13:30:04 +, BartC wrote: Steven D'Aprano st...@pearwood.info wrote in message news:53159540$0$2923$c3e8da3$76491...@news.astraweb.com... It's that explicitly part that doesn't follow. Having to manage types is the most tedious, boring, annoying, *unproductive* part

Re: OT Sine Rule [was Re: Functional programming]

2014-03-04 Thread Tim Chase
On 2014-03-04 14:42, Mark Lawrence wrote: What do you get if you differentiate versines, haversines, karosines, cuisines and limosines? Well, with cuisines, you can usually differentiate by seasoning: your Tex/Mex is spicier and tends to have chili cumin, while your Indian tends to lean more

Re: Functional programming

2014-03-04 Thread Steven D'Aprano
On Tue, 04 Mar 2014 14:59:51 +, Grant Edwards wrote: After a couple decades of working in software development, I've decided that comments like that are not correct often enough to be useful. You've got to reverse-engineer the code if there's no such comment. If there _is_ a comment, you

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 2:18 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: You don't need to have static typing to have declared variables. The two are independent. E.g. one might have a system like Python, except you have to declare your variables before using them: global x

Re: Functional programming

2014-03-04 Thread Steven D'Aprano
On Wed, 05 Mar 2014 02:28:17 +1100, Chris Angelico wrote: On Wed, Mar 5, 2014 at 2:18 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: You don't need to have static typing to have declared variables. The two are independent. E.g. one might have a system like Python, except you

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 2:45 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Aside: If you declare your locals, you shouldn't need to declare your globals. Though I could imagine a rule that global rebinding still needs to be declared, but you certainly shouldn't need to declare

Re: Functional programming

2014-03-04 Thread MRAB
On 2014-03-04 15:13, Chris Angelico wrote: On Wed, Mar 5, 2014 at 1:55 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 04 Mar 2014 14:05:44 +, Mark Lawrence wrote: Once a statically typed language has been compiled the programmer can head down to the pub. It

Re: Functional programming

2014-03-04 Thread Marko Rauhamaa
Antoon Pardon antoon.par...@rece.vub.ac.be: In the same way writing unit tests is the most tedious, boring, annoying, *unproductive* part. Amost always you are giving the program results it can work out for itself. Undoubtedly, explicit type declarations add a dimension of quality to

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 6:49 AM, Marko Rauhamaa ma...@pacujo.net wrote: public ConnectionPool(int maxConnections, String url) throws SQLException { try { super(() - { try { return DriverManager.getConnection(url); } catch ( SQLException ex )

Re: Functional programming

2014-03-04 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: On Wed, Mar 5, 2014 at 6:49 AM, Marko Rauhamaa ma...@pacujo.net wrote: public ConnectionPool(int maxConnections, String url) throws SQLException { try { super(() - { try { return DriverManager.getConnection(url);

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 7:50 AM, Marko Rauhamaa ma...@pacujo.net wrote: The rigmarole is trying to get around Java's mandatory exception handling limitations, which Python doesn't have. You are not allowed to pass a lambda to the super constructor that throws an SQLException. To get around the

Re: Functional programming

2014-03-04 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: Oh, it's THAT problem. Well, it's still not really a fair comparison of declared types. It shows how Python's much easier to work with, but what you're showing off is the simpler exception handling :) The other example I gave is really bread-and-butter Java.

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 8:21 AM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: Oh, it's THAT problem. Well, it's still not really a fair comparison of declared types. It shows how Python's much easier to work with, but what you're showing off is the simpler exception

Re: Functional programming

2014-03-04 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: C++ at least has typedefs, and in the newer standards, the 'auto' keyword was repurposed. Last I checked, C++ had no satisfactory way to express callbacks/functors/listeners/lambdas. That's why Qt came up with a metacompiler to supplement C++'s facilities. No,

Re: Functional programming

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 8:43 AM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: C++ at least has typedefs, and in the newer standards, the 'auto' keyword was repurposed. Last I checked, C++ had no satisfactory way to express callbacks/functors/listeners/lambdas.

Re: Functional programming

2014-03-04 Thread Gregory Ewing
Marko Rauhamaa wrote: Python doesn't have anonymous inner classes, but it has named inner classes, and that's quite sufficient. I would say it's Python's closures that make up for not having Java's inner classes. Or to put it another way, inner classes are Java's kludgy way of working around

Re: Functional programming

2014-03-04 Thread Marko Rauhamaa
Gregory Ewing greg.ew...@canterbury.ac.nz: Marko Rauhamaa wrote: Python doesn't have anonymous inner classes, but it has named inner classes, and that's quite sufficient. I would say it's Python's closures that make up for not having Java's inner classes. Or to put it another way, inner

Re: Functional programming

2014-03-03 Thread Alister
On Mon, 03 Mar 2014 06:14:09 +0700, musicdenotation wrote: If Python is not a fnctional language, then which programming paradigmis dominant? Python follows the Pythonic paradigm :-) -- Hope this helps some, sorry for not being able to do a brain dump. - Mike Stump helping a

Re: Functional programming

2014-03-03 Thread Bob Martin
in 718085 20140302 231409 musicdenotat...@gmail.com wrote: If Python is not a fnctional language, then which programming paradigmis dom= inant?= Labels are always misleading. -- https://mail.python.org/mailman/listinfo/python-list

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 6:57:15 AM UTC+5:30, Ned Batchelder wrote: On 3/2/14 6:14 PM, musicdenotation wrote: If Python is not a fnctional language, then which programming paradigmis dominant? is_a_functional_language() is not a binary condition, yes or no. It's a continuum. Python has

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Mon, Mar 3, 2014 at 10:45 PM, Rustom Mody rustompm...@gmail.com wrote: - cannot do a 'type-incorrect' expression like [1,2] + [[3,4],[5]] [1, 2, [3, 4], [5]] What do you mean by type-incorrect? This is adding two lists and getting back a list. Seems perfectly correct to me. ChrisA --

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 5:50:37 PM UTC+5:30, Chris Angelico wrote: On Mon, Mar 3, 2014 at 10:45 PM, Rustom Mody wrote: - cannot do a 'type-incorrect' expression like [1,2] + [[3,4],[5]] [1, 2, [3, 4], [5]] What do you mean by type-incorrect? This is adding two lists and getting back a

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 7:18:00 PM UTC+5:30, Rustom Mody wrote: Unfortunately modern versions give a less helpful error message '++' is list-append, '?' is the prompt ? [1,2] + [[3,4],[5]] Whoops Wrong cut-paste! ? [1,2] ++ [[3,4],[5]] ERROR: Type error in application

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody rustompm...@gmail.com wrote: ? [1,2] + [[3,4],[5]] ERROR: Type error in application *** expression : [1,2] + [[3,4],[5]] *** term : [1,2] *** type : [Int] *** does not match : [[Int]] IOW [1,2,[3,4],[5]] is a type-wise

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 7:30:17 PM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody wrote: ? [1,2] + [[3,4],[5]] ERROR: Type error in application *** expression : [1,2] + [[3,4],[5]] *** term : [1,2] *** type : [Int] *** does not

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:08 AM, Rustom Mody rustompm...@gmail.com wrote: How do you know that [1,2] is a list that must contain nothing but integers? By extension, it's also a list that must contain positive integers less than three, so adding [5] violates that. And [] is a list that must

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 7:53:01 PM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 1:08 AM, Rustom Mody wrote: How do you know that [1,2] is a list that must contain nothing but integers? By extension, it's also a list that must contain positive integers less than three, so adding

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 1:38 AM, Rustom Mody rustompm...@gmail.com wrote: If you want the (semantic) equivalent of python's [1,2,'foo'] you need to make an explicit union Int and String and its that *single* union type's elements that must go in. In all cases its always a single type. And so

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Monday, March 3, 2014 8:31:47 PM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 1:38 AM, Rustom Mody wrote: If you want the (semantic) equivalent of python's [1,2,'foo'] you need to make an explicit union Int and String and its that *single* union type's elements that must go

Re: Functional programming

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote: This is why it's tricky to put rules in based on type inference. The programmer's intent isn't in the picture. Of course it is. If I assign 23 to variable x, that signals my intent to assign an int to x. By Occam's razor, it is

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 4:27 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote: This is why it's tricky to put rules in based on type inference. The programmer's intent isn't in the picture. Of course it is. If I assign 23

Re: Functional programming

2014-03-03 Thread Gregory Ewing
Steven D'Aprano wrote: Given that x is an integer, and that you add 1 (also an integer) to it, is it really necessary to tell the compiler that add_one returns an integer? What else could the output type be? Just because the compiler *can* infer the return type doesn't necessarily mean it

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 9:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: def frobnicate(flang, splets, queeble=False): Righteously frobnicate the flang. :param flang: A file-like object, opened for reading. I had to read that a few times before I was sure that you

Re: Functional programming

2014-03-03 Thread Ben Finney
Gregory Ewing greg.ew...@canterbury.ac.nz writes: Just because the compiler *can* infer the return type doesn't necessarily mean it *should*. When I was playing around with functional languages, I ended up adopting the practice of always declaring the types of my functions, because it helps

Re: Functional programming

2014-03-03 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: On Tue, Mar 4, 2014 at 9:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: def frobnicate(flang, splets, queeble=False): Righteously frobnicate the flang. :param flang: A file-like object, opened for reading. I had to

Re: Functional programming

2014-03-03 Thread 88888 Dihedral
On Monday, March 3, 2014 10:08:11 PM UTC+8, Rustom Mody wrote: On Monday, March 3, 2014 7:30:17 PM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody wrote: ? [1,2] + [[3,4],[5]] ERROR: Type error in application *** expression : [1,2] + [[3,4],[5]]

Re: Functional programming

2014-03-03 Thread Steven D'Aprano
On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: On Tue, Mar 4, 2014 at 4:27 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote: This is why it's tricky to put rules in based on type inference. The programmer's

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Tuesday, March 4, 2014 11:05:24 AM UTC+5:30, Steven D'Aprano wrote: On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: It's not possible to sub-specify a type (like the string('a'..'x') type in Pike that will take only strings with nothing but the first 24 lower-case letters -

Re: Functional programming

2014-03-03 Thread Chris Angelico
On Tue, Mar 4, 2014 at 4:35 PM, Steven D'Aprano st...@pearwood.info wrote: On Tue, 04 Mar 2014 05:37:27 +1100, Chris Angelico wrote: x = 23 # Compiler goes: Okay, x takes ints. x += 5 # Compiler: No prob, int += int -- int x = str(x) # Compiler: NO WAY! str(int) -- str, not allowed! It's

Re: Functional programming

2014-03-03 Thread Rustom Mody
On Tuesday, March 4, 2014 11:34:55 AM UTC+5:30, Chris Angelico wrote: On Tue, Mar 4, 2014 at 4:35 PM, Steven D'Aprano wrote: I have not used Haskell enough to tell you whether you can specify subtypes. I know that, at least for numeric (integer) types, venerable old Pascal allows you to

Re: Functional programming

2014-03-02 Thread Terry Reedy
On 3/2/2014 6:14 PM, musicdenotat...@gmail.com wrote: If Python is not a fnctional language, then which programming paradigmis dominant? Python is an object based procedural language with builtin classes and many functional features. Arguing about the precise wording of such a statement is

Re: Functional programming

2014-03-02 Thread Ben Finney
musicdenotat...@gmail.com writes: If Python is not a fnctional language, then which programming paradigmis dominant? Python uses a mixture of programming paradigms. Object-oriented, procedural, functional, and probably some I don't recall. So it's not accurate to say “Python is not a

Re: Functional programming

2014-03-02 Thread Roy Smith
In article mailman.7605.1393805404.18130.python-l...@python.org, Terry Reedy tjre...@udel.edu wrote: On 3/2/2014 6:14 PM, musicdenotat...@gmail.com wrote: If Python is not a fnctional language, then which programming paradigmis dominant? Python is an object based procedural language

Re: Functional programming

2014-03-02 Thread Ned Batchelder
On 3/2/14 6:14 PM, musicdenotat...@gmail.com wrote: If Python is not a fnctional language, then which programming paradigmis dominant? is_a_functional_language() is not a binary condition, yes or no. It's a continuum. Python has more functional constructs than Pascal, and fewer than

Re: Functional programming

2014-03-02 Thread Steven D'Aprano
On Mon, 03 Mar 2014 06:14:09 +0700, musicdenotation wrote: If Python is not a fnctional language, then which programming paradigmis dominant? Object oriented and procedural are about equally dominant, with a strong influence from functional paradigm. There are small amounts of imperative

Re: Functional Programming and python

2013-10-01 Thread Chris Angelico
On Tue, Oct 1, 2013 at 11:36 AM, rusi rustompm...@gmail.com 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

Re: Functional Programming and python

2013-10-01 Thread Neil Cerutti
On 2013-10-01, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info 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

Re: Functional Programming and python

2013-10-01 Thread Piet van Oostrum
Antoon Pardon antoon.par...@rece.vub.ac.be writes: Op 30-09-13 20:55, Piet van Oostrum schreef: Franck Ditter nob...@nowhere.org 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

Re: Functional Programming and python

2013-09-30 Thread Franck Ditter
In article ba94102b-18b6-4850-ac85-032b0fe2f...@googlegroups.com, rusi rustompm...@gmail.com 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:

Re: Functional Programming and python

2013-09-30 Thread Chris Angelico
On Tue, Oct 1, 2013 at 3:04 AM, Franck Ditter nob...@nowhere.org 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

Re: Functional Programming and python

2013-09-30 Thread Neil Cerutti
On 2013-09-30, Franck Ditter nob...@nowhere.org wrote: In article ba94102b-18b6-4850-ac85-032b0fe2f...@googlegroups.com, rusi rustompm...@gmail.com wrote: I touched upon these in two blog-posts: 1. http://blog.languager.org/2013/06/functional-programming-invades.html 2.

Re: Functional Programming and python

2013-09-30 Thread Piet van Oostrum
Franck Ditter nob...@nowhere.org 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

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

Re: Functional Programming and python

2013-09-30 Thread Antoon Pardon
Op 30-09-13 20:55, Piet van Oostrum schreef: Franck Ditter nob...@nowhere.org 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

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 been

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

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 bullshit.

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

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:

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

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 something like

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 currying at

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 in

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 parameter or at

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 only freeze the first

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 Chris Angelico
On Wed, Sep 25, 2013 at 1:07 AM, rusi rustompm...@gmail.com 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

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 Pascal,

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 in