How To Run Pure Erlang Functions In Elixir — Tentamen Software Testing Blog

Image for post
Image for post
Erlang base64 Pure function in Elixir

TL;DR

In the previous post, we presented how to run modules and functions in runtime. Elixir is integrated with Erlang. Today we present how to run pure Erlang functions from Elixir. This post is part of the functional language series, and it is based on the remarkable book Elixir In Action by Sasa Juric.

Pure Erlang Function

In the previous post we used our first pure Erlang function from Elixir:

:code.get_path

Before inventing the wheel in your own Module, first, search for that functionality in Erlang Module

Dynamic Execution

Elixir is a static language because it requires compilation before execution. But it is possible to execute an Elixir function in runtime using Kernel.apply the function. You will see a lot of this function in stack traces, during the development of your future applications.

Image for post
Image for post
Elixir dynamic execution using Kernel apply function.

Remember

  • find Erlang Module

Originally published at https://blog.tentamen.eu on November 11, 2020.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store