This Week's Trending
This Month's Trending
This Year's Trending
Hi! I might be asking a silly one, sorry for that and thanks for your time!
my aim is to implement quite simple logic:
the get_or_creat...
New
Last Three Year's Trending
How can I pattern match against an arbitrary sized tuple? This works:
{status, _, _} = {:ok, 1, 2}
But what if I don’t know the structu...
New
Hi,
I was surprised I couldn’t find any argument on this on the net so here I am.
When you make recursive function that deal with list ...
New
Say I have a very large data structure who’s size is in the 10s of MB. This structure is arbitrarily complex, consisting of many tuples ...
New
Hi! Quick question from a guy coming from Javascript:
Whenever I have to handle some conditional behavior, like ‘do something depending ...
New
iex(26)> "hello " <> matched = "hello world"
"hello world"
iex(27)> matched
"world"
iex(28)> matched <> " world" = "...
New
Hello, I have been developing a simple macro and now I want to improve it and let it accept nested option.
For example:
guardedstruct do...
New
I’m not fully understanding how matching works with function arguments. In Functions and Pattern Matching it is explained (IMO poorly) th...
New
I was wondering if there is a way to return both the variables (e.g., :“$1”), and its matched value with a single call to :ets.select(tab...
New
I’m trying to build a simple function to see if a user is authorized to join a conversation. Basically, it needs to query the mysql datab...
New
I’ve got this bit of code; I’m wondering why create_or_open_room always creates a new room, even when there is an existing child process ...
New
version
elixir: 1.16.0
erlang: 26.2.1
Hi! When I used pattern match with japanese words like this below
String.match?("あ", ~r/[りんご]/)...
New
Hi folks!
With the new release of Elixir 1.18, I would like to enforce pattern-matching by struct in our projects to take advantage of t...
New
defmodule Navigator do
def navigate(dir) do
expanded_dir = Path.expand(dir)
go_through([expanded_dir])
end
def go_through...
New
I have a case clause (contrived for the purpose of this question):
level = 4
has_children_or_no_children = :no_children
case {level, ha...
New
Trending Over Three Years
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
Rust has a very nice semantics for Option<T> and Result<T,E> These two have similar uses but have a clear distinction about e...
New
Given these two maps:
map1 = %{a: 1}
map2 = %{a:1, b: 2}
This works fine:
%{a: 1} = map2
But these do not:
iex> ^map1 = map2
*...
New
Hello everybody,
As it’s possible to partially pattern match with maps like so:
iex> %{b: 2} = %{a: 1, b: 2, c: 3}
%{a: 1, b: 2, c: ...
New
I have the following code:
defp has_char_in_string?(value), do: Regex.match?(~r/[^\d]/, value)
def somefun(arg) do
case has_char_...
New
I have seen the pattern %_{} being used to match against structs (notice the _ after the %).
Is this documented somewhere? It seems to m...
New
Im trying to get one element and the rest of the map with pattern matching but I’m only get compile errors.
I came up with this:
%{“One...
New
I refactored a code from:
def do_something(attribute) do
bar = get_bar(attribute)
baz = get_baz(bar)
do_something_else(attribute,...
New
We can match arguments like this in elixir:
iex(1)> f = fn(a, [b: a]) -> a end
...
New
So I've been working on some projects that envolve external services/API's that provide data in XML and JSON. In some of these services I...
New
Here nums is a list of [list of {tuples}].
nums = [[{5,2}], [{10,2},{4,5}], [{6,5},{3,10},{2,15}]]
I want to print output like this:
1...
New
Hi,
Given
test = %{a: 1, b: [%{c: 1,d: 2}] }
How do I pattern match to get values c and d? I tried the following:
%{a: a, [%{c: va...
New
How would I map over something like this?
results = [
{"John Smith", %{"twitter" => "jsmith"}},
{"Lisa Smith", %{"twitter" =>...
New
I have a nested JSON HTTP response I want to map to my structs. All responses are formatted: {"_embedded": {"entity": [entity-specific js...
New
Latest on Elixir Forum
Get money off!
The Pragmatic Bookshelf
35% off any eBook
Manning Publications
45% off any item
ElixirCasts
10% off for life
The Pragmatic Studio
20% off any course
AppSignal
10% off for 12 months
Honeybadger
10% off for 12 months
Simply use coupon code "devtalk.com" or "elixirforum" at checkout!
Filter by Type:
Sub Categories:
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #ash-questions
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #exunit
- #discussion
- #javascript
- #elixirconf
- #library
- #oban-questions
- #dialyzer
- #docker
- #onsite
- #authentication
- #podcasts
- #full-time-contract
- #umbrella
- #code-sync
- #ecto-query
- #phoenix_html
- #iex
- #graphql
- #genstage
- #elixir-ls
- #nerves-questions
- #podcasts-by-brainlid
- #supervisor
- #websockets
- #distillery
- #advent-of-code
- #blog-post
- #livebook-questions
- #processes
- #forms
- #api
- #metaprogramming







