Which areas of Elixir did you find confusing to begin with?

For me (and I guess many others?) it was (so far anyway) probably the match operator and the concept of pattern matching :icon_redface: :lol:

I played with Erlang for 2-3 months before picking up Elixir as well and found the pattern matching + multiple heads to be an interesting approach to program design, but reading the Elixir Poker tutorial really showed me the beauty possible with it.

App supervision trees, where to split concerns, what failure strategies etc. thats whats taking most of my attention at the moment.

2 Likes

My biggest problem is the OOP-Thinking in my head. I know that Elixir instead is processing a stream of data with transformation functions, instead of modeling and modifying objects.

Also i was in lack of patterns to use like i know from OOP. Even when these will not be the same, there must be a “common knowledge” useable for Elixir.

3 Likes

The most confusing thing for me is the syntax. I find it mostly natural until I want to do something in particular, then I am constantly stumbling about where to put parens or commas or colons, and the compiler error messages are too vague. I think I need to read that Metaprogramming in Elixir book to really know what’s going on, since most of the language constructs are really macros, e.g. “if”. Many of the peculiar usages are not covered in the “Getting Started” guide. For example, did you know you can |> pipe into a case construct, or pattern match its output to a var? This article on with was particularly helpful to show these syntactic peculiarities. Maybe I will get a better hang of it while going through Programming Elixir 1.2.

3 Likes

Coming from imperative scripting languages, for me is the lack of scopes namespaces and the concept of context. I am still at the getting started guide so I can have been missing something. I am also not used with the use of a VM but the language is really cool and with a lot of features that are sharpening my programmer’s sight :smile:

2 Likes

For me I think it’s been mostly OTP/concurrency, but that’s because I’ve never truly grasped these concepts from a theoretical standpoint as well as in other languages. Although Elixir has been a pleasant surprise to learn about this subject.

4 Likes

I am interested in meta programming in Elixir, so I spend a lot of time to read about it.
But then I met “unquote fragment”, this make me so confused and I did not understand what is different between unquote fragment an normal unquote.

Then I figure our, all def and defmarco actually is a macro, that is make sense. And it makes “unquote fragment” is clear with me.

3 Likes

@kiennt what’s the path you recommend to learn Metaprogramming in Elixir (besides the book with the same name :stuck_out_tongue: )

1 Like

I’m still very much a beginner in Elixir but, coming from Ruby, I am still very much attached to the Object Oriented Programming so I always want to call methods on the objects themselves, as in "my_string".upcase.
It took me a while to realise that it’s not how it is done in Elixir. Instead you call a function defined in a module and you pass the object as the first argument like this String.upcase("my_string").

Right now, I’m still struggling a bit with the functional nature of the language but I’m happy to say that I now understand the concepts better than when I tried my hand at Scala.

3 Likes

Honestly, the biggest thing I’m having trouble wrapping my head around is recursion.

1 Like

I had a tough time with it too – many years of imperative loops. When it clicks, you’ll feel it and never look back :wink:

1 Like

Why not start a thread about recursion @detectivemittens? It may prove useful to others too :slight_smile:

I haven’t got to the chapter on recursion myself yet so I’d be interested in hearing everyone else’s thoughts…

1 Like

What book are you reading through @AstonJ? If you read Dave Thomas’s Programming Elixir, he starts bringing up recursion problems pretty early in the book. I’m trying to work through the problems, and the simplest recursion problems are pretty easy to figure out. There’s a pattern. But make it a little more complex and I’m confused…

1 Like

I’m currently 10% of the way through Programming Elixir, and I believe the chapter on Recursion is Chapter 7 (Lists and Recursion) - the bits I have read about it so far do make sense - but it’s possible the more complex stuff might not :lol:

Just noticed the alert that you’ve posted another thread, will chime in over there too…