Macros

Learn how to extend common library functionality to other graph type libraries using macros.

The __using__/1 and use/2 macros

The idea is to build these wrapper functions in the common library and inject them into the particular graph type library. We’ll make use of the __using__/1 macro for this, which will be called by the use/2 macro.

We’ll just show the graph functions here, but we’ll also have a parallel set of query functions. Let’s show this in the outline first.

Here’s our graph type library module, which has a use/2 macro for the common graph module GraphCommons.Graph:

Get hands-on with 1200+ tech skills courses.