4 ms·
I'm roughly in the same boat. Part of it is that different communities have different definitions of purely functional. Check me out, I'm about to say a bunch
by tunesmith 14y ago
I'm roughly in the same boat. Part of it is that different communities have different definitions of purely functional.
Check me out, I'm about to say a bunch of things as if they're fact, in the hopes that someone will correct me where I'm wrong!
So, a few decades ago two groups of people came to the determination that anything calculable can be expressed through a Turing machine or through lambda calculus.
The Turing machine was sorta step-by-step and nuts-and-bolts and inspired the imperative branch of programming languages.
Lambda calculus is more denotive and inspired functional programming.
Now this part is confusing. Because if you ask "What language should I learn to explore lambda calculus?" people will tend to answer Lisp variants. Whereas if you ask "What language should I learn to learn functional programming?" people will tend to answer Haskell.
I understand the differences between Haskell and Lisp - Haskell is more restrictive and pure, while Lisp is incredibly supple with its code-is-data-is-code approach - but I thought functional programming came from lambda calculus. In other words, I don't understand what lambda calculus is that functional programming isn't or vice versa.
Anyway, what's generally seen as the most "purely functional" language is Haskell. Opinions vary on how pragmatic a language it is to learn (as judged by job openings and active projects), but it's widely seen as the language to learn if you want to learn and "get" functional programming concepts most efficiently. In other words, learn some Haskell, and it makes other functional languages easier to learn.
My basic choice (as an imperative programmer that knows java, perl, php) was whether to learn some kinda java-esque functional language, or Haskell, or a lisp variant (including java-esque lisp like Clojure). I'm choosing to learn Haskell, and then move over to Scala, since I hear and suspect that is a better way to learn Scala than to go directly to Scala, and since I'm interested in enhancing my existing body of knowledge rather than switching career paths entirely.
BTW, there's a third big family of programming language, logical programming languages (Prolog, etc). I thought I saw that Erlang is influenced by some concepts from that. So at least in my head, it has seemed like Erlang is the language I'd want to learn if I really wanted to blow my mind with a mixture of functional, concurrency, and logical-programming concepts.
- fusiongyro 14y ago> I don't understand what lambda calculus is that functional programming isn't or vice versa. It's a bit like wondering what part of procedural programming is using a turing machine and which part isn't. :) The theory is theory and the practice is practice; in the end, what you're using is pretty far from it but it retains some of the flavor. The flavor of lambda calculus is one of substitution and reduction. Expressions are evaluated, values replaced, variables bound. Even something like Scheme is pretty far from it, but it is close enough that if you want to study one the other will help. The basic lambda calculus you hear about is usually the original untyped lambda calculus. The typed lambda calculus isn't much more worse, but bears a stronger resemblance to ML and so forth. I have not found the absence of a background in lambda calculus to be much of an impediment to learning and applying functional programming. Presence of the word "calculus" tends to make us think something is grand and mystifying. In this particular case my impression is that it is an interesting theoretical diversion and that's about all one needs to know. > I thought I saw that Erlang is influenced by some concepts from that Well... Erlang was originally implemented in Prolog. And the syntax borrows from Prolog in many places. However, Erlang is absolutely not a logic programming language because there is no unification happening within it. It is really cool in its own right though. The world of logic programming continues to be dominated by Prolog, which is an amazing, somewhat practical and beautiful language, but also warty old hog at the same time. Mercury gets brought up from time to time, and it should be amazing, but lacking a repl it leaves me cold. Apart from these two there are a handful of multiparadigm languages that have some constraint handling, such as Oz or one of the embedded Prologs for Lisp (Allegro has a good one), and then there's things like CLIPS or Jess or JBoss Drools, but for dedicated logic languages it's still essentially just Prolog. I'm a huge fan of Prolog, by the way! I don't think it helps much with learning functional programming but it definitely will blow your mind, and probably more than FP would too. If you wind up trying it out and getting stuck, drop me a line or ask a question on SO. I frequently leave huge answers there and the community is very friendly.
- tunesmith 14y agoThis sounds great. I've had a side curiosity in the subject (logic programming) for a while (mostly just limited to experimentation in Drools so far) so I'll keep your username in mind. Thanks!
- fusiongyro 14y agoNo problem. :)