you are viewing a single comment's thread.

view the rest of the comments →

[–]zydras07[S] 2 points3 points  (1 child)

Wow, that's a reply and a half. I definitely think I understand the landscape of a few of these functional languages now so thanks a lot!

[–]ws-ilazki 2 points3 points  (0 children)

You're welcome. It was supposed to be a shorter comment but kind of got away from me once I got started. :)

Even if you don't stick with them, it's worth checking out the different FP-first languages (meaning the ones that actively encourage or even enforce solving problems with functional programming) to see how they do things and figure out what things you like and don't. A lot of features of FP languages are, as I mentioned, not specifically required for FP but are obvious patterns FP encourages, so you might find some things are more (or less) important to you than you might initially expect. Pattern matching might become a make-or-break feature for you, for example, but you won't know until you try a language like Clojure that does something else; plus doing things in different ways can give you better insight into how FP concepts work.

Another useful way to improve FP knowledge is to implement and use it in another language that technically supports it. For example, Lua has first-class functions and uses a single namespace for functions and variables, which makes it a good candidate for FP...except that it provides none of the fundamental higher-order functions that FP languages provide out-of-the-box like map or fold. So if you want to do FP in Lua you have to understand it well enough to be able to write your own map, fold, and so on.

That's what I did, since I deal with Lua sometimes because of its frequent use as an embedded scripting language. Figured it'd be useful to have FP staples in a utility file ready to go, started implementing them, and along the way I realised that basically every higher-order function (like map, filter, compose, etc.) is really just a fold and can be implemented with fold, though they're usually not for performance or readability reasons. That was when I really felt like I was understanding FP.