6 ms·
Functional Languages 101: What’s All the Fuss About?
- rasmusfabbe 15y agoGiven that the majority of web surfing is done on mobile these days, it's pretty naïve to put pictures inside a Flash object. Wont be viewing those slides any time soon. (Also, functional programming FTW!)
- mediocregopher 15y ago>Given that the majority of web surfing is done on mobile these days Based on what? I can't find a single article that would back that up. Although I do agree that doing anything with Flash is just shooting yourself in the foot.
- novalis 15y agoI had no problem watching that on my mobile, what are you on about?
- jon6 15y agoI stopped listening when she said 'code and data are the same thing in a functional language'. Well not really, code and data are the same in a homoiconic language, but really any language with sufficient reflection capabilities can mix code and data. It has nothing to do with being functional.
- debacle 15y agoBut all functional languages are Lisp, right?
- spacemanaki 15y agoNot sure if you're being facetious, but no, not all functional languages are Lisps. Haskell, ML, Ocaml, and Scala all come to mind as functional languages that are far from Lisp.
- debacle 15y agoI was being facetious. Sorry.
- yaginolio 15y agothis is what happens when mathematicians try to understand computers
- davidmr 15y agoWhat about Jon Von Neumann (and many others)? Your comment is excessively snarky and wrong.
- deleted 15y ago[deleted]
- moistgorilla 15y agoIf you want to understand functional programming read SICP.
- ericmoritz 15y agoand if you have less time on your hands, spend an evening with The Little Schemer.
- Create 15y agoThe book mostly deals with teaching recursive thinking; basically being the notes of a very didactic two week introduction. Do not read the book in fewer than three sittings. So a little more than an evening if you really want to obey the rules, and most importantly: never, ever feed the gremlin (elephant) after midnight.
- ericmoritz 15y agoWhoops. Perhaps I am due two more sittings then.
- babarock 15y agoDisclaimer: I am currently going through SICP (I'm approximately 200 pages in). So far, I do not get the impression the I'm learning functional programming. Sure, I learn all about map, fold and filter. Sure I've picked this up these concept and apply them almost exclusively to my "regular job" programming in Python. But I'm not learning about functional programming. What I mean is that assignments are simply never mentioned (so far). Everything is acting as if FP is the only natural way to program (I'm a professional programmer, but keep in mind that this book is geared towards beginners with little-to-no prior exposure to programming). Anw, my point is that SICP will have you program a lot in FP style, but won't spend time explaining what FP is, or how is it different from your 'standard' procedural paradigms. I hear that you can write in various paradigms with Scheme, I wouldn't be surprised that they'd be mention in this book. In short, SICP is a wonderful book that will teach you how to build (well "structure") your programs, focusing on mastering complexity to manage large systems. It's not an absolute reference about FP.
- pohl 15y agoOne of the things Dr. Parsons mentions here is how functional programming makes it easier to reason about programming because of the lack of side-effects. That makes sense to me, and I heard it frequently whenever someone is giving the FP sales pitch. I wonder, though, whether there is a tradeoff that is going unmentioned, and I suspect that it is that it makes it more difficult to reason about costs. I feel trapped when I'm writing in a language like Java, but at least the cost model is obvious to me. Am I off base here? Is there some way to develop a similar intuition about costs in an FP language?
- soc88 15y agoI think the best way is to have a good taste when choosing how to solve the problem. Going purely functional (Haskell) has its own benefits but also a lot of drawbacks. If you don't go purely functional, it doesn't make sense to avoid imperative or OO features where they make sense. In that sense, I think languages which fuse and unify functional and OO approaches are a good strategy. There is a bit of negativity towards them, because they manage to piss off both OO evangelists as well as functional preachers, but that doesn't detract from the technical benefits of such an approach.
- spacemanaki 15y agoMost of my functional programming experience is with Clojure, and it's not very deep experience, so take this with a grain of salt. However I think reasoning about performance in Clojure isn't tremendously different than reasoning about performance in Java, and in some cases it might even be easier. Yes, it's true that you might have to learn some new idioms, like passing accumulators to tail recursive calls. But once you start structuring programs primarily as a collection of pure functions that operate on data structures like vectors and maps, I think profiling those functions is easier much in the same way that testing them can be easier. Obviously, depending on the language, you might have to develop new mental models for how to use certain features performantly (like lazy seqs and persistent collections in Clojure), but that's mostly true of any new language or even a new library.
- tobiasu 15y agoComputer use has shifted from calculating tables for ballistic missiles to manipulating gigantic amounts of state. And (pure) FP is the answer because it doesn't have the ability to manipulate state?
- soc88 15y agoSeems most of the talk is actually about Lisps. In my mind, functional languages and Lisp are two separate things. Lisps can be functional, but most of them are not.
- olliesaunders 15y agoSounds like your thinking of /purely/ functional programming. Although none of these terms have precise definitions so there’s not really any point arguing over them.
- soc88 15y agoNot really. Functional programming for me has a feeling of a mathematically sound foundation: This means a statically typed language with a powerful type-system and type inference. Immutability/effect system are a big plus. Broad range of data-structures and a decent object system are nice, too.
- Retric 15y agoI have no idea why you think statically typed languages have anything to do with Functional programming.
- soc88 15y agoThat's my second sentence.
- olliesaunders 15y agoLooks like everyone ignored that bit where I said there was no point arguing over it :)
- anamax 15y ago> Functional programming for me has a feeling of a mathematically sound foundation: This means a statically typed language with a powerful type-system and type inference. Mathematical soundness does not require type inference. It's unclear whether it requires static typing. And, it can easily get by with almost no type-system.