Call Elixir from Erlang

Posted on 07 Jul 2017 by Eric Oestrich

I've been reading the Designing for Scalability with Erlang/OTP book and because of that I've been getting interested in writing some erlang code. I got curious if I could call my elixir code from erlang.

This is very simple. Since module and function names are just atoms in erlang you can call them like this:

'Elixir.IO':'puts'("Hello, world!").

Elixir puts all of it's modules "under" the Elixir atom. So to call an Elixir function named Api.User.changeset() you would use 'Elixir.Api.User':'changeset'().

comments powered by Disqus
Eric Oestrich
I am:
All posts
Creative Commons License
This site's content is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License unless otherwise specified. Code on this site is licensed under the MIT License unless otherwise specified.