3 ms·
Tell us what was your starting point and references used to learn FP
by mesarvagya 8y ago
Tell us what was your starting point and references used to learn FP
- onlyrealcuzzo 8y agoFirst -- over a few years -- I had slowly started writing functional-ish code in Ruby on the backend and React/Redux on the front-end. Ruby is kind of nice in that there's not an easy way to iterate over a list without functional code. You start mapping and reducing pretty regularly, and then discover the power of higher-order array functions, and how it lends itself nicely to functional programming. React/Redux is nice in that it pretty much forces you to wrap your head around the way functional programming works. React/Redux was definitely a step up from Spaghetti-jQuery for me, but I'd stop short of calling it an enjoyable experience. It wasn't until I started playing around with Elixir that I really fell in love with functional code. In a lot of ways, Elixir is really similar to Ruby, which makes it pretty easy to dive in (for a Ruby-ist). But in subtle ways, its functional nature really shines. The |> is perhaps my favorite programming concept I've come across. It's so simple, but it forces you to think about -- and at the same time makes it natural to comprehend -- the way data flows through your application. Don't get me wrong, Elixir is still very much a functional language. It's allure in that it looks like an imperative language and has a lot of similarity to Ruby is misleading. The learning curve might not be as steep as say, Lisp, but it' still quite steep. And I think it'd take around the same time to be meaningfully proficient in either. Glad I got my Elixir/BEAM rave out for the day.
- fluxinflex 8y agoA "me too" for Elixir. Coming from a Ruby background, picking up Elixir wasn't hard at all (disclaimer: I have done some FP in the past). What I found really good about Elixir is the solid documentation[1], easy comparing of libraties[2], the mix[3] tool that made starting a project really simple. But what really blew me away were doctests[4]. Basically I ended up writing my unit tests where my code was. That was my documentation for the code, so there was no need to maintain unit tests and documentation separatetly. [1]: https://elixir-lang.org https://elixir-lang.org & https://hexdocs.pm/elixir/Kernel.html https://hexdocs.pm/elixir/Kernel.html [2]: https://elixir.libhunt.com https://elixir.libhunt.com [3]: https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html https://elixir-lang.org/getting-started/mix-otp/introduction... [4]: https://elixir-lang.org/getting-started/mix-otp/docs-tests-and-with.html https://elixir-lang.org/getting-started/mix-otp/docs-tests-a...
- Elrac 8y agoMy own intro to FP happened via Ruby and Clojure. I wrote a rinky-dink Web application while teaching myself Ruby and Ruby on Rails. It turned out most of the pages were constructed from a database query returning a batch of results which then needed filtering, sorting and various kinds of massaging. I ended up really enjoying doing this work by applying a series of higher order functions like for() and map() to the data set. This got me started on thinking functionally. Years later, I decided I wanted to do more with Lisp while continuing to work with the Java ecosystem. Clojure is a Lisp that runs on the JVM and is rather solidly functional. It's possible but very awkward to do mutation. If you don't want to run with shackles, you need to embrace immutability and FP. I found myself fighting FP until eventually I saw the light and was able to productively embrace it.