News for hackers. Stuff that matters.
Re:The Development of Erlang (1997) by travisgriggs on Thursday June 03, 2021 @01:04AM (#27377414)
I am learning Elixir... and I really get a kick out of it. It's zany and pushes me to bend my brain.

It's like sort of Dr Seuss riff for an experienced programmer.

So you've done a lot of program?

Can you, can you, without a reference?

Could you, could you, with nary a pointer?

Will you, will you, use no return?

No for loop? And less control flow goop?

I had to switch back to do some Python and Swift maintenance/development last week after 2 solid weeks of climbing the Elixir newbie staircase, and I was amazed at how much code I write in "normal" languages whose sole purpose is to decide where the code goes next. For the first hour or two my brain kept screaming "why do you keep putting all of these if blocks everywhere?!"

Re:The Development of Erlang (1997) by truth_ on Thursday June 03, 2021 @02:13AM (#27377784)
What are the best resources to learn Elixir for a programmer? And what are you using?
Re:The Development of Erlang (1997) by ddek on Thursday June 03, 2021 @02:27AM (#27377859)
I liked the book ‘Elixir in Action’. It shows some of the language then immediately jumps into building a way too overcomplicated program (a distributed TODO list) that nicely shows off the features of elixir.

After that I just read some codebases. I find elixir codebases extraordinarily easy to read. The language does a great job of making ‘the good way’ also ‘the easy way’, and the linear nature of functional code is much clearer than the usual indirect dependency injected hell. Papercups is a fairly good starting point I think. I liked the livebook codebases too.

Re:The Development of Erlang (1997) by Maultasche on Thursday June 03, 2021 @06:20PM (#27388175)
I've been writing a lot about Elixir as I've been learning it: https://inquisitivedeveloper.com/. The idea is for people to learn Elixir along with me as I learn it.

It's not a quick start though: I really dig into how Elixir works and move fairly slowly. I've finished covering the language itself, and I'm about to move into the OTP functionality that's inherited from Erlang.

Re:The Development of Erlang (1997) by atulatul on Thursday June 03, 2021 @04:35AM (#27378562)
I used Dave Thomas's Programming Elixir > 1.6 and can recommend it highly for learning the language.

As others have mentioned on some other threads, learning about OTP, Genserver is really worthwhile. Apart from language, the book teaches a bit about that too. But maybe just enough.

https://www.amazon.com/gp/product/B07DP8Y2GJ

Re:The Development of Erlang (1997) by AlchemistCamp on Thursday June 03, 2021 @06:34PM (#27388307)
Elixir in Action is in a class by itself. I'd also recommend Phoenix in Action as a nice quick start and the many, many Elixir books from Pragmatic Bookshelf. I've read almost all of them and all of them are well-written and well-edited.

Also, the official docs and guides are fantastic once you have your bearings.

Re:The Development of Erlang (1997) by travisgriggs on Thursday June 03, 2021 @01:34PM (#27384678)
The Elixir-lang Slack channel. The Dave Thomas book. Lots of trial and error in iex. For me, I have to a meaningful thing to do with a language/platform to learn it. The To Do/hello world apps just do nothing for me.
Re:The Development of Erlang (1997) by swhitf on Thursday June 03, 2021 @04:20AM (#27378494)
I learned using https://alchemist.camp/. Some content is premium but the free stuff is very good if you don't want to commit.
Re:The Development of Erlang (1997) by aroccolli on Thursday June 03, 2021 @07:42AM (#27379783)
https://serokell.io/blog/learn-elixir - I've made a guide to Elixir resources.
Re:The Development of Erlang (1997) by theagilecoder on Thursday June 03, 2021 @10:05AM (#27381555)
I learned the concepts from dave thomas's book and then drilled them into my mind using exercism.io
Re:The Development of Erlang (1997) by 1MachineElf on Thursday June 03, 2021 @01:15AM (#27377470)
I really felt that story. Mind if I ask, where are you working and what was the Elixir project?
Re:The Development of Erlang (1997) by travisgriggs on Thursday June 03, 2021 @01:32PM (#27384634)
The project is ongoing; I work at an automation company :)
Re:The Development of Erlang (1997) by slver on Thursday June 03, 2021 @04:43AM (#27378609)
How does erlang eliminate if blocks.
Re:The Development of Erlang (1997) by ratww on Thursday June 03, 2021 @04:55AM (#27378680)
With Pattern Matching
Re:The Development of Erlang (1997) by slver on Thursday June 03, 2021 @07:54AM (#27379906)
Hm that’s if expressions.
Re:The Development of Erlang (1997) by weatherlight on Thursday June 03, 2021 @10:30AM (#27381913)
https://erlang.org/doc/reference_manual/expressions.html#pat...

it's more like the = sign in math mathematics.

2x = 10 we can deduce x = 5

Here's an elixir example where a bunch of "if/else" blocks are refactored to use case statements, and then from case statements to pattern matching.

https://nickjanetakis.com/blog/refactoring-elixir-code-if-co...

Re:The Development of Erlang (1997) by cannabis_sam on Thursday June 03, 2021 @12:28PM (#27383711)
No..?

If-expressions is a specialized version that only works on booleans, pattern matching is a more general concept (that of course can be used to implement if-expressions, but so can pure lambda calculus)

Re:The Development of Erlang (1997) by travisgriggs on Thursday June 03, 2021 @01:38PM (#27384744)
I did not mean to imply that there are no if blocks in Erlang/Elixir. Just that I use them a whole lot less. Probably an order of magnitude less.

And you still have to decide where your code goes at some level. The pattern of having two function variants (one which matches an empty list, and one the head/tail) is a different idiom to looping. So while for loops go away, you still traverse sequences. And more generally, a lot of the if(else) clauses I would normally write, now get solved with pattern matching.

With control flow languages, the where the code goes and what the code does feel very intertwined, whereas with the pattern matching idioms, I find that where it goes, and what it does, are more orthogonally declared.

Re:The Development of Erlang (1997) by saba2008 on Thursday June 03, 2021 @10:47AM (#27382185)
And if statement is just syntax sugar over goto.

After using mostly Erlang for several years, 'if' feels like ugly atavism.

Re:The Development of Erlang (1997) by dnautics on Thursday June 03, 2021 @10:18AM (#27381734)
technically, they are case statements. Even the if is just sugar over case.