\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{zokratez} \pdfinfo{ /Title (elixir.pdf) /Creator (Cheatography) /Author (zokratez) /Subject (Elixir Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{4E2A8E} \definecolor{LightBackground}{HTML}{F3F1F7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Elixir Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{zokratez} via \textcolor{DarkBackground}{\uline{cheatography.com/211420/cs/45803/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}zokratez \\ \uline{cheatography.com/zokratez} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 12th March, 2025.\\ Updated 3rd March, 2025.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{p{0.73724 cm} p{0.36862 cm} x{1.07953 cm} p{0.44761 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{3.833cm}}{\bf\textcolor{white}{Enum types}} \tn % Row 0 \SetRowColor{LightBackground} I need... & \seqsplit{Function} & Example & BigO \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Execute without return & \seqsplit{Enum.each/2} & Enum.each({[}1,2,3{]}, \&IO.puts/1) & O(n) \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} Transform each element & \seqsplit{Enum.map/2} & Enum.map({[}1,2,3{]}, \&(\&1 * 2)) \# {[}2,4,6{]} & O(n) \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} Filter elements & \seqsplit{Enum.filter/2} & Enum.filter({[}1,2,3{]}, \&(\&1 \textgreater{} 1)) \# {[}2,3{]} & O(n) \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} Accumulate a value & \seqsplit{Enum.reduce/2} & Enum.reduce({[}1, 2, 3, 4{]}, fn x, acc -\textgreater{} x * acc end) & O(n) \tn % Row Count 15 (+ 4) % Row 5 \SetRowColor{white} Find a value & \seqsplit{Enum.find/2} & Enum.find({[}1,2,3{]}, \&(\&1 \textgreater{} 1)) \# 2 & O(n) \seqsplit{(worst} case) \tn % Row Count 18 (+ 3) % Row 6 \SetRowColor{LightBackground} Check if all match condition & \seqsplit{Enum.all?/2} & Enum.all?({[}2,4,6{]}, \&rem(\&1, 2) == 0) \# true & O(n) \seqsplit{(worst} case) \tn % Row Count 21 (+ 3) % Row 7 \SetRowColor{white} Check if exists inside & \seqsplit{Enum.member?/2} & Enum.member?({[}1,2,3{]}, 2) \# true & O(n) \tn % Row Count 24 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.57627 cm} x{1.2132 cm} x{1.24353 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Data Structure Types}} \tn % Row 0 \SetRowColor{LightBackground} Data \seqsplit{Structure} & Access Compex & Observations \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} list & O(n) & sorted, duplicated keys \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} tupple & O(1) & \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} map & O(1) map \textgreater{} 32 / O(n) map \textless{} 32 & unsorted, no key duplication \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{keyword} list & O(n) & Inserting with prepend is O(1) \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{Maps \textless{} 32 are sorted lists \newline Maps \textgreater{} 32 are hash-tree (HAMT) \newline Lists, when insert prepend for O(1), append is O(n)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.45495 cm} x{1.27386 cm} x{1.30419 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Sort Algoritms}} \tn % Row 0 \SetRowColor{LightBackground} Name & Time Complex & Comments \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Merge Sort & 🔹 O(n log n) / O(n log n) / O(n log n) & Recommended in Elixir (recursive and stable) \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{Insertion} Sort & ✅ O(n) / 🔺 O(n$^{\textrm{2}}$) / O(n$^{\textrm{2}}$) & Good for small or semi-ordered lists \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} Radix Sort & O(nk) / O(nk) / O(nk) & Very fast on small integers \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{Bubble} Sort & ✅ O(n) / 🔺 O(n$^{\textrm{2}}$) / ❌ O(n$^{\textrm{2}}$) & Inefficient, useful only for small or already sorted lists \tn % Row Count 13 (+ 4) % Row 5 \SetRowColor{white} \seqsplit{Selection} Sort & 🔺 O(n$^{\textrm{2}}$) / O(n$^{\textrm{2}}$) / O(n$^{\textrm{2}}$) & Simple, but slow \tn % Row Count 16 (+ 3) % Row 6 \SetRowColor{LightBackground} \seqsplit{QuickSort} & ✅ O(n log n) / O(n log n) / ❌ O(n$^{\textrm{2}}$) & Better than MergeSort on average, but can degrade to O(n$^{\textrm{2}}$) \tn % Row Count 20 (+ 4) % Row 7 \SetRowColor{white} Heap Sort & O(n log n) / O(n log n) / O(n log n) & \tn % Row Count 23 (+ 3) % Row 8 \SetRowColor{LightBackground} \seqsplit{Counting} Sort & O(n + k) / O(n + k) / O(n + k) & Only works with small numbers and limited range \tn % Row Count 26 (+ 3) % Row 9 \SetRowColor{white} \seqsplit{Bucket} Sort & O(n + k) / O(n + k) / O(n$^{\textrm{2}}$) & Useful if data is evenly distributed \tn % Row Count 29 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{Avoid: \newline QuikSort because we can get O(n$^{\textrm{2}}$) if the list is already sorted. \newline Insertion (O(n$^{\textrm{2}}$)) → If the list is inverted.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Merge Sort}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline defmodule MergeSort do \newline def sort({[}{]}), do: {[}{]} \newline def sort({[}x{]}), do: {[}x{]} \newline \newline def sort(list) do \newline midpoint = div(length(list), 2) \newline \{left, right\} = Enum.split(list, midpoint) \newline \newline new\_left = sort(left) \newline new\_right = sort(right) \newline \newline merge(new\_left, new\_right) \newline end \newline \newline def merge(left, {[}{]}), do: left \newline def merge({[}{]}, right), do: right \newline \newline def merge({[}l | left{]}, {[}r | right{]}) when l \textless{}= r do \newline {[}l | merge(left, {[}r | right{]}){]} \newline end \newline \newline def merge({[}l | left{]}, {[}r | right{]}) do \newline {[}r | merge({[}l | left{]}, right){]} \newline end \newline end \newline \newline \newline MergeSort.sort({[}2,4,6,7,1,2,3,5{]})} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Insertion Sort}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline defmodule Sort do \newline def insert({[}{]}, x), do: {[}x{]} \newline \newline def insert({[}h | t{]}, x) when x \textless{}= h, do: {[}x, h | t{]} \# Insert before if is lower \newline \newline def insert({[}h | t{]}, x), do: {[}h | insert(t, x){]} \# Continue searching if is greater \newline \newline def insertion\_sort({[}{]}), do: {[}{]} \newline \newline def insertion\_sort({[}h | t{]}) do \newline sorted\_tail = insertion\_sort(t) \newline insert(sorted\_tail, h) \newline end \newline end \newline \newline Sort.insertion\_sort({[}3, 1, 4, 2{]})} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Detect Anagram}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline defmodule Anagram do \newline def anagram?(word1, word2) do \newline \seqsplit{Enum.sort(String.graphemes(word1))} == \seqsplit{Enum.sort(String.graphemes(word2))} \newline end \newline end \newline \newline IO.inspect(Anagram.anagram?("listen", "silent")) \# true} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{O(n log n) because Enum.sort} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Palindrome}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline defmodule Palindrome do \newline def is\_polindrome?(word) do \newline word\_to\_charlist = to\_charlist(word) \newline (word\_to\_charlist == \seqsplit{Enum.reverse(word\_to\_charlist))} \newline end \newline end \newline \newline Palindrome.is\_polindrome?("acbca")} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{Use recursive option is less performance. It uses List.last/1 and Enum.drop/2 (O(n) each), making the complexity O(n$^{\textrm{2}}$).} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Fibonacci}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline defmodule Fibonacci do \newline def fib(n), do: fib(n, 0, 1) \newline \newline defp fib(0, a, \_b), do: a \newline defp fib(n, a, b), do: fib(n - 1, b, a + b) \newline end \newline \newline IO.inspect(Fibonacci.fib(10)) \# =\textgreater{} 55} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{O(n)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{2.91805 cm} p{0.51495 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Fast Enum Reference}} \tn % Row 0 \SetRowColor{LightBackground} Acumulate & \seqsplit{reduce} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Return in map or diff type than map & \seqsplit{reduce} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Return list & map \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} Discard / Clean & \seqsplit{filter} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{0.92691 cm} x{2.50609 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Liveview callbacks}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{mount} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \seqsplit{handle\_event} & clicks, forms, keys, hooks. \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{handle\_info} & messages from other processes (send) \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{handle\_params} & Respond to URL changes \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Actor model}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{The actor model is a concurrency paradigm in which {\bf{processes (called actors)}} communicate exclusively through message passing, {\bf{without sharing memory.}} \newline % Row Count 4 (+ 4) The actor model uses a {\bf{FIFO queue-like}} structure to process messages, but encapsulated in each actor. \newline % Row Count 7 (+ 3) It is not a traditional queue because each actor is an autonomous and concurrent system.% Row Count 9 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.44186 cm} x{1.99114 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{GenServer Callback}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{init} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{3.833cm}}{handle\_call} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{handle\_cast} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{3.833cm}}{handle\_info} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} code\_change & Hot code update \tn % Row Count 5 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{2}{x{3.833cm}}{terminate} \tn % Row Count 6 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.33887 cm} x{2.09413 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Best for inserts / updates}} \tn % Row 0 \SetRowColor{LightBackground} Lists (Prepend) & {[}new\_item | list{]} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Maps insert & Map.put O(1) except hash collisions \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} Maps update & \%\{map | a: 42\} better than Map.put \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} Keyword List (Prepend) & {[}\{:key, val\} | kw\_list{]} \tn % Row Count 7 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Process Communication Elixir/Erlang}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{Interprocess communication in Erlang and Elixir is based on the {\bf{actor model}} and is completely {\bf{asynchronous}}. Each process is lightweight, running on the BEAM virtual machine, and has its {\bf{own state}} and {\bf{message queue}}. Processes {\bf{do not share memory}}, allowing for {\bf{lock-free concurrency}} and fault tolerance. \newline % Row Count 7 (+ 7) 1-Erlang cookie is same in 2 nodes \newline % Row Count 8 (+ 1) 2-Node1 ask for the Node2 port using {\bf{EPMD}} \newline % Row Count 9 (+ 1) 3-Node 1 send a message to the {\bf{EDP}} (Erlang Distribution Protocol) \newline % Row Count 11 (+ 2) {\bf{Difference with process messaging in Java and why is better?}} \newline % Row Count 13 (+ 2) Because Java uses OS threads, these can share memory, every thread use stack and OS resources.% Row Count 15 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Strings to charlist}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline \#Directly using sigil \textasciitilde{}c \newline \textasciitilde{}c"abc" \newline \newline \#from symbol \newline def foo(name) do \newline to\_charlist(name) \newline end} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.3033 cm} x{1.54683 cm} x{1.18287 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Imports, alias, use, require}} \tn % Row 0 \SetRowColor{LightBackground} use & Extend modules and add functionality & use GenServer \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{require} & Use macros from another module & require Logger \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{import} & Use functions without module prefix & import Enum, only: {[}map: 2{]} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} alias & Short modules names & alias MyApp.Foo.Foo2 \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Difference GenServer VS GenState}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{GenServer has state and response to casts. \newline GenState is data-flow with backpresure.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{String to List ("AB"=\textgreater{}{[}"A", "B"{]})}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\{\{lang-elixir\}\} \newline String.graphemes("AB")} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Interfaces with Elixir (polymorphism)}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{first defines the {\bf{@callbacks}} in an interface module... \newline % Row Count 2 (+ 2) Then implement in a module using {\bf{@behavior}} \newline % Row Count 3 (+ 1) Lastly, when we "override" a function defined in interface or which has a {\bf{callback}} use `@impl true`% Row Count 6 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{inheritance in Elixir}} \tn \SetRowColor{white} \mymulticolumn{1}{x{3.833cm}}{The most similar to "inheritance" is to use the `use` macro. This extends functions in the module.% Row Count 2 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{p{0.54594 cm} x{1.2132 cm} x{1.27386 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{OBAN vs EXq}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Caracterist} & OBAN & Exq \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} DB & Postgres & Redis \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \seqsplit{Distributed} & Multi-node & Needs Redis Cluster \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{Retries} & Configurable with backoff & Less flexible \tn % Row Count 7 (+ 2) % Row 4 \SetRowColor{LightBackground} \seqsplit{Scalable} & Excelent for big systems & Good, but depends on Redis \tn % Row Count 9 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}