A few lines of Erlang Code to explain basic syntax and concepts alongside a presentation
This repository serves as a collection of a few erlang files which I and a study partner used to explain and showcase the basics of the Erlang syntax, functionality and some core concepts of the language. They have little to no explanation in inline comments, as these examples were used alongside a presantation.
The idea with these files is an iterative expansion. They revolve around a catshop, in which workes a catshop clerk. Customers can order cats and return them. This example was very vaguely inspired by some chapters of the Book Learn You Some Erlang for great good!.
The general structure is as follows:
Modules, imports and exports, records and basic functions
Recursion, Pattern Matching, Case Statements, a main loop
Processes, Message Passing, receive statement, Process Linking and Monitoring, basically a simple server
Reeimplementation of the simple server using the gen_server behaviour
Small changes to the clerk to introduce process crashes requiring certain conditions (eww a pink cat). The purpose of this version is the demonstation of a supervisor.
A module implementing the supervisor behaviour. Supervising multiple Clerks working in the catshop. Fires everyone if one clerk freaks out about specifically colored cats.