How have you used Metaprogramming in Elixir?

I used it to create an Ecto.Schema like dsl for generating CSV in CsvGenerator.

3 Likes

Spark — spark v2.2.35 Finally got around to providing an actual getting started for spark :slight_smile: it’s not amazing, but it’s something and I’m limited on time :sweat_smile:

9 Likes

I’m using metaprogramming in phoenix_storybook to discover the storybook content within the project files. This way, the storybook’s navigation maps directly to the storybook folder structure.

It extensively uses @external_resource to recompile the stories and update the storybook’s navigation as soon as a relevant file has been updated.

Code :point_right: here


Also leveraging on @before_compile to read source files (and save the source content as a generated meta function) at compilation time while source files are available (they aren’t at runtime).

Code :point_right: here

1 Like

Verlixir is an interesting proof of concept that converts the quoted expression version of an Elixir program into a Promela model.

1 Like

Also linked here, which has an interesting set of slides that use Elixir and TLA+ to teach distributed algorithms.

1 Like