Live data from Hacker News

Functional Programming in Python [pdf]

oreilly.com

51–60 of 62 posts

Re: Functional Programming in Python [pdf]

#51
post #30

It's becoming more common to see "Functional Programming in X". Why don't we use functional languages like oCaml or Haskell more often? Are we making the jump in two steps instead of one? I've never written more than a few lines of either so I can't tell if something "better" is waiting for me in functional land.

I'd go one further.

Why are there so very few programs written in say, haskell, that you actually want to use?

This is a serious question that I haven't found the answer for. Around here people suggest pandoc, shellcheck and sometimes the xmonad window manager as pretty much the full list of things you can install, use and hack on written in haskell whose purpose isn't writing haskell code.

Given the popularity of haskell amongst hackers and the various claims about its benefits and strengths, the fact this list is so small (if it's larger and I'm missing a bunch - please DO let me know, I want to play with them and hack on them!) Is something I have difficulty reconciling with haskell being a useful general purpose programming language. Maybe they're being written now and they're on their way? But haskell has been around for more than a few years now. Maybe haskell hackers just mostly hate open source & free software unless it's GHC or a general purpose library? Seems unlikely. So maybe something else I don't yet understand. It is puzzling when I don't code in the language fluently enough to understand its weaknesses as opposed to my own in coding in the language and it's a point the many lovers of haskell never seem to address other than with extreme defensiveness which kind of misses the point of the question.

Re: Functional Programming in Python [pdf]

#52
post #20
post #10

Funny how things turned out. I still remember this post[1], it was profoundly disappointing to see Guido's way of thinking. Much of the damage was reversed but it still left an indelible impression that there's a lack of vision for what's going to be important if the language is to stay relevant in the future. [1] http://www.artima.com/weblogs/viewpost.jsp?thread=98196

I actually find his arguments rather convincing, even though I'm partial to a functional approach to programming, myself.

Some are still pretty bullshit though.

> Why drop lambda? Most Python users are unfamiliar with Lisp or Scheme, so the name is confusing

To which I'd reply: Why drop class? Most Python users are unfamiliar with C++ or Java, so the name is confusing.

Re: Functional Programming in Python [pdf]

#53
I am curious why lists do not have ".map" and ".filter" methods? IMHO it would be so better for chaining, now using a few maps and filters is inconvenient and looks unreadable. Plus, something shorter for "lambda"...

It's one of not too man aspects, where I prefer JavaScript (especially ES6) to Python.

Re: Functional Programming in Python [pdf]

#54
post #51
post #30

It's becoming more common to see "Functional Programming in X". Why don't we use functional languages like oCaml or Haskell more often? Are we making the jump in two steps instead of one? I've never written more than a few lines of either so I can't tell if something "better" is waiting for me in functional land.

I'd go one further. Why are there so very few programs written in say, haskell, that you actually want to use? This is a serious question that I haven't found the answer for. Around here people suggest pandoc, shellcheck and sometimes the xmonad window manager as pretty much the full list of things you can install, use and hack on written in haskell whose purpose isn't writing haskell code. Given the popularity of ha…

> Why are there so very few programs written in say, haskell, that you actually want to use?

I think a big part of it was struggling with cabal hell. I know that quite a bit of web development and API stuff is happening with Haskell since I've gotten paid to do some for multiple clients (some requesting Haskell).

I think that with the release of stack[0] (and it eventually being merged into the Haskell platform IIRC) many application developers will start to pick up Haskell and create those types of programs.

Not open source, but an application created in Haskell was bump[1].

0: https://github.com/commercialhaskell/stack 1: https://www.fpcomplete.com/wp-content/uploads/Bump-case-stud...

Re: Functional Programming in Python [pdf]

#55
post #53

I am curious why lists do not have ".map" and ".filter" methods? IMHO it would be so better for chaining, now using a few maps and filters is inconvenient and looks unreadable. Plus, something shorter for "lambda"... It's one of not too man aspects, where I prefer JavaScript (especially ES6) to Python.

That would require any new container classes to implement each of those methods again (and will probably still lack useful ones, like groupby) whereas currently they can just implement iteration and get the rest for free.

You could have both approaches, but that would go against one of Python's core principles ("There should be one-- and preferably only one --obvious way to do it.").

Re: Functional Programming in Python [pdf]

#59
post #52
post #20

Earlier quoted context omitted.

I actually find his arguments rather convincing, even though I'm partial to a functional approach to programming, myself.

Some are still pretty bullshit though. > Why drop lambda? Most Python users are unfamiliar with Lisp or Scheme, so the name is confusing To which I'd reply: Why drop class? Most Python users are unfamiliar with C++ or Java, so the name is confusing.

Are they? I'd probably argue just the opposite, that most python developers are very familiar with C++ or (most of them) Java.

Re: Functional Programming in Python [pdf]

#60
For anyone wanting a quick intro to fp in Python I stumbled into this awesome presentation (50 slides) about Functional Programming in Python. I especially like his short but clear examples: http://kachayev.github.io/talks/uapycon2012/#/ . Good intro before getting deeper into the linked book.
Post reply on HN