Hacker News new | past | comments | ask | show | jobs | submit login

How does Common Lisp compare with elixir. I'm trying to find a good functional language to learn.



If your goal is specifically to learn functional programming, I recommend you consider Lisp-1 dialects instead of Common Lisp, like Scheme or Clojure. While CL supports functional programming (it supports literally everything) functions exist in a separate namespace, and treating functions as data can be a little extra confusing.

As for Elixir: it heavily leans on the actor model. Understanding this was the biggest hurdle for me, but once I got over that learning Elixir was a breeze (though I was already comfortable with FP by the time I picked up Elixir). If you want to go the Elixir route, I recommend trying to play around with an actor model system in a language you are familiar with first. I was familiar with Scala so I learned the actor model by playing with Akka.

My #1 recommendation to you though is to go with Scheme and watch the SICP lectures. That will sneak functional programming into your brain without you even realizing it.


I had a similar question. I decided to learn Erlang / Elixir first. Starting with Elixir and thought that I should probably learn Erlang first since it's going to come up. I actually like Erlang a lot and use it as much as I can. There are use-cases where Elixir is more suitable, e.g. web development using the amazing Phoenix Framework.

Anyway, I found myself doing REPL development using both Erlang and Elixir. Many of the benefits that I read about CL seem to exist within these languages as well.

I hope to explore CL eventually, but I'm just having too much fun with Erlang / Elixir at the moment.


CL is the most interactive (by far). Its image-based development and its tooling (Emacs&Slime or other IDEs) offer more features. Elixir's tooling is more classic, focused on good tools on the terminal. CL has a pretty good type inference, which happens interactively too (you can compile a function with a shortcut and have instant compiler feedback). Elixir people say that in practice pattern matching alleviates from type issues. It seems to me CL will have a wider range of applications (good for number crunching, different implementations); it's possible to build self-contained binaries in CL.

CL isn't entirely functional, nor pure FP, you can mutate things (and can not to with some care, or with libraries) and you can mix styles (with OOP etc).


To get a good answer you need to clarify what you mean by a functional language. Do you simply mean a language that has first class functions, or do you mean something that's inspired by category theory, or something somewhere in between?


You could check out Lisp Flavored Erlang if you want a little of both languages. Perhaps even Shen.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: