logoalt Hacker News

sevenzeroyesterday at 7:18 PM10 repliesview on HN

Oh shit here I go (and learn Elixir for a whole year (again)) again.

I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again.

Sucks that it's not really a beginner friendly ecosystem and usually, when having questions answered, people assume you already know a lot about the language.


Replies

pjm331yesterday at 7:28 PM

https://pragprog.com/titles/lhelph/functional-web-developmen...

don't let the title fool you - the first half of the book is just elixir

over the past 8 years this is the book i've used to ramp back up on elixir and it works like a charm every time - i've never finished it

for me, a mark of a good programming book in this tutorial-project style is that I have started it half a dozen times and never finished it because at some point before the end I've been equipped w/ the tools to go off and do my own thing

show 4 replies
isityettimeyesterday at 8:59 PM

> I love everything about Elixir, but Elixir constantly makes me doubt myself like no other language. My brain isnt made for functional stuff, but this makes me want to try again.

I experienced this really painfully when I was in college and took a kind of "survey of programming paradigms" course and tried Haskell for the first time. I'd been programming for years by then, and I couldn't believe how helpless I was at trying to complete things that had long felt "basic" to me.

But I don't think it's about the brain not being suited, I think it's that contrast of your experience level in imperative languages vs. the fact that when working in a pure functional style, you start out as a newbie again.

I think you'll gradually improve. I think the thing that finally made functional programming feel comfy for me was realizing how much I love composing code that basically feels like more generously spaced Bash "one-liners". The data starts out in one shape, so you run a command to dump it. Then you think of a step that gets it closer to what you want, you pipe it to that next command, and you take another look. And you keep going and at the end what you're looking at is typically pretty close to a series of transformations of data that you never mutate!

Part of what makes this feel comfy in the shell is that you build up that vocabulary of commands just by puttering around your file system every day. Over the years my library of familiar "functions" in a Unix-like environment has grown quite large. In a pure functional programming environment, you have to do the same thing but it takes a little more effort to learn the vocabulary. Your most frequently used "commands" will be functions like map, fold, and zip instead of grep, cat, or sort. But the core of it is really the same, and what I love about building pipelines applies equally to both: you can build it piece by piece, and for each puzzle you're on, you can forget about the previous steps and just think about the next transformation of the data that's in front of you. There is something refreshingly, relaxingly low-context about that.

Anyway I hope you give it a try and enjoy it. When we can learn to enjoy being bad at something, that's how we finally get good at it.

pdimitaryesterday at 7:23 PM

I invite you to ask on ElixirForum. I have never seen a truly hostile response.

Sometimes posts don't get traction due to ambiguity, and some smelled like "do my homework" so people ignored them.

But every post with a genuine curiosity in it gets answered, as far as I can tell.

show 1 reply
mihaelmyesterday at 7:28 PM

Do you maybe know some Rust? I'm also not that experienced with FP languages, but Gleam felt familiar enough, due to some Rust-isms, to allow me to focus more on the concepts rather than the syntax. Granted, I spent a few afternoons with it, but if I were to pick a FP language again to wrestle my brain into submission, I'd probably go with Gleam due to familiarity.

show 1 reply
jimbokunyesterday at 8:00 PM

Comments like this always confuse me as object oriented programs riddled with state are much harder to reason about to me.

show 2 replies
sodapopcanyesterday at 11:24 PM

Come hang out on Elixir Forum! Lots of friendly folks there who are happy to answer (and re-answer) beginner questions. It's not quite what it was a few years ago thanks to LLMs, but it's still quite active.

EDIT: I see my cohort has already given you this suggestion :P

adamddev1yesterday at 8:23 PM

Do https://htdp.org and follow all the exercises carefully (yes, it will feel like baby work at first) - you will retrain your brain for functional stuff. :-)

ai_criticyesterday at 7:25 PM

What functional stuff is throwing you off? A whole bunch of it can be written procedurally when starting out.

show 1 reply
cpursleyyesterday at 7:56 PM

I find beginners respond well to this resource: https://joyofelixir.com/toc.html

qaqyesterday at 7:24 PM

community is super nice I am sure you will get help.