Building the Wolfram Info System
Now that we have our generic InfoSys module in place, we can work on specific backends. We’ll start with only one, our Wolfram backend. This module will call WolframAlpha to retrieve relevant information about our users’ annotations.
Our first step is to define our backend interface. Since all our backends will have the same contract, this is a perfect use case for a backend behaviour. A behaviour is a contract, a common API across modules. We have seen OTP behaviours, such as GenServer and Supervisor, as well as behaviours from libraries like Plug. Remember, each plug implements two functions, init/1 and call/2. Our behaviour will be a tiny contract between the information system and each backend, consisting ...
Get Programming Phoenix 1.4 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.