Skip to content

Comment on Your favourite programming language is not good enoughparent

Comments

I would add a functional language to this list. Even if you're not going to use it for real world programming it's likely that it will change the way you code. This is something that is often said and I think you need to experience it for yourself to understand what it means. For example learning a bit of Erlang and Scheme has changed the way I program in Python.

Obligatory PG essay on "If [Functional Programming] makes you a better programmer, [why wouldn't you use it all the time?]" for massive upvotes. (Please don't upvote this comment.)

http://paulgraham.com/avg.html

I hate functional programming languages but love functional programming. I think the way Python does it is really good, combining the power with readability, whereas the functional languages I've seen are completely unreadable (operators named caadr and car?). So I totally agree with you. Spend a few weeks diving into functional languages, then run away as fast as you can IMO.

Python has functional features, but if you perceive it as being better than functional languages for functional programming, then I'm going to assert that you need to do some more serious functional programming. I say this as both a Python person and a functional programmer: Python can do functional programming, but it discourages it heavily, which is why whipping up e.g. parser combinators or monads is definitely possible but usually has some odd mismatch and either requires Python hackery or results in verbose and tedious code.

The comment about car and cdr suggests that your functional experience is a Lisp dialect; might I suggest Haskell or ML? Haskell ranges from beautifully readable to inscrutable, depending on who wrote the code—definition of arbitrary operators is beautiful, if used sparingly, and terrifying, if used heavily—while the MLs are much more consistent, but don't push you into the functional zone nearly as much and consequently are more immediately useful but less mind-expanding.

So you bring up some good points, I admit I am a little saddened to see my comment downvoted though and hope to clear a few things up. First the point I was making was about my experience, I understand I do not have deep functional programming experience. I don't perceive Python as being better than functional languages for functional programming, but rather I see it as offering the good functional qualities I personally have seen while still being good at other paradigms, I imagine if you desire pure functional programming it probably does not stack up to pure functional languages.

My experience is an AI class in Lisp and TA-ing a class that taught students Scheme and a lot of Python experience, so you are right, perhaps I should check out Haskell or ML for better readability. Although I think Python discourages functional programming itself, from what I've seen it heavily encourages functional features, between lambda functions, functions as first class objects, and list comprehension which offers mapping, filtering, and reducing. I know there are other functional features that I haven't been exposed to, but as far as the techniques taught at a college level class, I feel Python incorporates functional features beautifully, and I now find myself using functions as objects, lambdas, mapping, filtering, and reducing nearly every day I program. I know the "pure-ness" of functional languages isn't there as Python encourages side effects, but as far as giving average programmers functional power while maintaining readability, I like Python's adaptation of functional techniques.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.