gusaiani

gusaiani

Hi all,

I like to study Elixir’s source and I don’t know a lot of Erlang.

I got curious about these function declarations as I could not understand how a call to this function would match some guards.

We have in line 137:

dot(Meta, Left, Right, nil) when is_atom(Right) ->

then the next declaration in line 145:

dot(Meta, Left, {Right, _, Context}, nil) when is_atom(Right), is_atom(Context) ->

how does it work that the one in line 145 is ever reached? Same for the one in line 148.

Cheers!

Source here:
https://github.com/elixir-lang/elixir/blob/06f086a21e170a233acf4aaae02f39717d28020d/lib/elixir/src/elixir_quote.erl#L137-L149

Showing Posts 1 to 2

NobbZ

NobbZ

{Right, _, Context} is not an atom but a tuple, therefore is_atom/1 returns false.

gusaiani

gusaiani OP

Ah ok! Thanks NobbZ!

— All posts loaded —

Where Next? Top

Trending in Chat/Questions Top

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews