Elixir Diary Day 1: Playing with IEx
Elixir Diary Day 1: Playing with IEx

Elixir Diary Day 1: Playing with IEx

Tags
Elixir
Published
Published October 16, 2022
Author
Vincent Taing
Documenting my journey in Elixir world.

Day 1 - Elixir Data structures

I like functionnal programming and I was pursuing some interest in Clojure, but seems like I’m doomed to have no friends 😞, people hate the (()(())) so much, as much as I tried, the experience of a beginner is fairly unfriendly. Tbh I don’t think it’s that big a deal.
In 2018, I missed the opportunity to contribute to an Elixir code because I wanted to excel in front-end, I guess it’s always time to catch up.
Okay, so on first day of school, I’m going through some chapters of this https://elixirschool.com/en/lessons/basics/collections
If I find Elixir very compelling, like everybody seems to say so .🐑🐑🐑. I’ll probably going to get a copy of a book and read it cover to cover.
I’ve mostly spent most of my career programming in JavaScript/Typescript. It’s pretty pleasant to do some basic programming operations without thinking about the quirks of the language. ie: comparing two maps/objects
Of course, starting a new task by bikeshedding around setting up emacs, because why not.
I was looking for a REPL dev experience close to what Clojure offer: being able to send lines of code to a REPL and evaluate it. I found this
inf-elixir
J3RNUpdated Aug 5, 2023

Going through data structures

  • Random thoughts:
    • Wow i can just deep compare map to another map and it works ? 🤯 exploding in JS.
      • iex(63)> %{:foo => "bar"} == %{:foo => "bar"} true iex(64)> %{:foo => "bar", :baz => %{:lol => "mdr"}} == %{:foo => "bar", :baz => %{:lol => "mdr"}} true iex(65)> %{:foo => "bar", :baz => %{:lol => "mdr"}} == %{:foo => "bar", :baz => %{:lol => "xd"}} false
    • Syntax does not matter, semantic does.
    • There’s many ways to express collections:
      • Keywords list
      • Maps
      • List
      • Tuple
    • Variables are not immutable ?
      • iex(60)> name = "George" "George" iex(61)> name = "Georgia" "Georgia" iex(62)> name "Georgia"
        I would have expected an error trying to overriding a “variable”.
         
    • You can use array as a key in a map ? 😮
    • I’m curious how much built-in methods there are in Elixir compared to a language like Clojure
    •