defrecord Person, first_name: nil, last_name: "Dudington" do def name record do # huh ? "#{record.first_name} #{record.last_name}" end end defrecord User, name: "José", age: 25 guy = Person.new first_name: "Guy" guy.name defmodule ListServer do @moduledoc """ This module provides an easy to use ListServer, useful for keeping lists of things. """ use GenServer.Behaviour alias Foo.Bar ### Public API @doc """ Starts and links a new ListServer, returning {:ok, pid} ## Example iex> {:ok, pid} = ListServer.start_link """ def start_link do :gen_server.start_link({:local, :list}, __MODULE__, [], []) end ### GenServer API def init(list) do {:ok, list} end # Clear the list def handle_cast :clear, list do {:noreply, []} end end {:ok, pid} = ListServer.start_link pid <- {:foo, "bar"} greeter = fn(x) -> IO.puts "hey #{x}" end greeter.("Bob")