logoalt Hacker News

throwawaymathslast Wednesday at 10:41 PM1 replyview on HN

elixir softens a whole ton of the sharp edges around getting started and there are only a handful of "gotchas" coming from other hlls (like all terms being immutable when you pass to a function -- but thats honestly almost a problem with the "mainstream" languages).


Replies

genewitchlast Thursday at 6:38 AM

So you'd do:

x = doubler(x)

Instead of treating the function like a "subroutine"? Like:

x = 10

doubler(x)

print x

I'm unsure why, but I use the former. Probably due to most sources saying global variables are bad and if I do it the latter way I get errors, whereas with the former I only get errors unrelated to scope.

I'm not a professional or even amatuer programmer, that's why I ask. My only exposure to Erlang unfortunately is from coding contests like advent of code and Codegolf stack; and those are "clever" and my brain doesn't abide clever. The inverse of "why use many words when few words will do"

In my own programs, if I go back and read the code I can tell what I copy-pasted vs what I understood as I wrote it, if that makes sense. Because clever stuff that solves the problem I've been unable to solve in the time I alloted will be in my code. You see anything pretending to be, or being a lambda in my code, I lifted it.

I would like to learn Erlang and there's been a few book recommendations aside from TFA. This comment also serves as my reminder to get some books.

show 1 reply