mingyar.furtado
Patern Matching on Koans
Hi! Could someone help me on that?
I’m trying to solve that one, it seems to be right but is not passing:
The original code is:
koan "Lists must match exactly" do
assert_raise ___, fn ->
[a, b] = [1, 2, 3]
end
end
And I’m trying that:
koan "Lists must match exactly" do
assert_raise ___, fn ->
[a, b, c] = [1, 2, 3]
end
end
Then the output is like “still the same”:
Lists must match exactly
Assertion failed in lib/koans/12_pattern_matching.ex:42
assert_raise(___, fn → [a, b, c] = [1, 2, 3] end)
Maybe I’m not understanding that structure calling an anonymous function.
I already had tested on my terminal doing just:
[a, b, c] = [1, 2, 3]
And it seems to be right ![]()
Marked As Solved
lud
Take a look at the docs for assert_raise/2 and assert_raise/3 to have the correct syntax.
3
Also Liked
mingyar.furtado
lud
The test is using assert_raise, so I guess you do not have to make the match work but just to provide the correct exception name at ___.
1
Popular in Questions
Hello, I get Persian date from my client and convert it to normal calendar like this:
def jalali_string_to_miladi_english_number(persi...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database.
Dep...
New
Hi,
is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work.
Or rather, not char, but a substr...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Other popular topics
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Hey :wave:t3: Elixir community,
I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New







