Map [1]
| Operation | Time Complexity | 
|---|---|
| Access | O(log n) | 
| Search | O(log n) | 
| Insertion | O(n) for <= 32 elements, O(log n) for > 32 elements [2] | 
| Deletion | O(n) for <= 32 elements, O(log n) for > 32 elements | 
| <!-- livebook:{"autosave_interval_s":null,"persist_outputs":true} --> | |
| # Data Types | |
| ## Basic Types | 
| defmodule Aplicar.Checks.SortModuleFunctions do | |
| use Credo.Check, | |
| base_priority: :low, | |
| explanations: [ | |
| check: """ | |
| Alphabetically ordered lists are more easily scannable by the read. | |
| # preferred | |
| def a ... | |
| def b ... | |
| def c ... | 
| case {:ok, 5} do | |
| {:ok, n} -> "this will match and n is 5: #{n}" | |
| {:error, n} -> "this will not match" | |
| end | 
| # the first argument for string.split is the return value of String.upcase("Hello Brooklin") | |
| # for functions with more than 1 parameter such as String.split, | |
| # skip the first argument because it's provided implicitly by the Pipe |> | |
| "Hello Brooklin" |> String.upcase |> String.split(" ") | 
| defmodule Greeting do | |
| def say_hello name, name2 do | |
| "Hello #{name}, Hi #{name2}" | |
| end | |
| end | |
| Greeting.say_hello "Bob", "Bill" # Hello Bob, Hi Bill | 
| defmodule AssertionTest do | |
| use ExUnit.Case, async: true | |
| test "always pass" do | |
| assert true | |
| end | |
| end | 
| defmodule Greeting do | |
| # syntax: import ModuleName only: [method_name: number_of_parameters] | |
| import IO, only: [puts: 1] | |
| def print_greeting(name) do | |
| puts "Hello " <> name | |
| end | |
| end | |
| Greeting.print_greeting("Brooklin") # Hello Brooklin | 
| defmodule Me do | |
| defmodule Info do | |
| def name do | |
| "Brooklin" | |
| end | |
| end | |
| end | |
| defmodule Greeting do | |
| alias Me.Info, as: Info |