Hacker News new | ask | show | jobs
by foxygen 284 days ago
I've been working with functional programming languages for the most part of my career now. Mostly Elixir and Clojure, but some OCaml/Haskell too. I believe after FP "clicks", there is no going back. Everything else feels just so unnecessarily complex.

My favorite is still Clojure by miles ahead, besides it being a functional language, its data-oriented approach to writing programs is completely different from anything else I've ever seen. I currently work with Elixir, and there isn't a day that goes by without me thinking "gosh, this would be so much simpler to solve in Clojure".

1 comments

> gosh, this would be so much simpler to solve in Clojure

My colleagues are so sick of hearing this.

How come? Genuinely curious.

I feel the same way with Go, OCaml, Factor, Erlang / Elixir, Common Lisp, and even Perl, depending on what I am doing. Heck, I still have new projects written in C due to its simplicity, which is what I want sometimes, and more control.

I end up working with a lot of data transform pipelines, and Clojure's strong support for names (with namespaced keywords) and generic data structure manipulation makes the code you have to write more succinct.

This kind of task is also extremely well suited to a repl. You define a temporary var, and start threading it through a series of super small functions that only slightly change the data until you get what you want.

    (->> my-data 
         parse
         (filter some-pred)
         (map my-mapper)) ;; and so on, if you need more
        
For me, the big thing is REPL driven development, and immutable data structures. Everything can be inspected. It's easy to get insight into basically any small piece of the program as if you were using a debugger (but you don't have to).