Share things relating to Elixir that put a smile on your face
Am I missing something? Something important? Like context?
Itâs just a common thing people say about other languages (that they donât scale very well) and obviously Elixir can
Argh, damn⊠The words âNo-one, Everâ below were misinterpreted as a subtitle by me. Only now I realise, that it is meant to be the person who said this and the date of the quote. So it is meant like this: âElixir doesnât scale.â said No-one, ever.
def get_available_internal_users do
user_coll = from(u in User,
select: {u.name, u.role, u.id},
where: u.role != "Client") |> Repo.all
for {name, role, id} <- user_coll, into: %{}, do: {{name, role}, id}
end
Just wrote this function to get all users from my projectâs DB which do not have the role of âClientâ and put their name, role and id into a map.
Such nice, concise and readable code.
First I was doing a lot of List.first/1
and List.last/1
and Tuple.to_list/1
to get the values into the map. Then it came to me âwhy not just pattern match the tuple and use the matches to get them into the Map?â and boom⊠that code came to fruition
Honestly canât think of any other language that would allow me to query a SQL DB, parse the data and make it all so readable and short. There isnât a need to write comments really, it reads by itself.
Awesome , I have become an elixir talk junkie since I started with elixir & erlang
cant wait for more talks on the tube
Via @rvirding
Hah. Favorite line:
I believe in Erlang, where I get to use concurrency
I love this video!
https://twitter.com/devoncestes/status/910411735458308096
By @devonestes
Well done all of you who make this the friendly, welcoming and helpful place that it is
By @cmeiklejohn
6 posts were split to a new topic: Your Programming Heroes - please post pics and stories!