- Logical Clocks/Time
- Leader Election
- Consensus / Agreement
- Failure Detector
- Causual Message Delivery
- Distributed Shared Memory
- Synchronizers
- Snapshot
- Mutual Exclusion
- Deadlock Detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Bar do | |
defmacro __using__(__opts) do | |
quote do | |
import unquote(__MODULE__) | |
end | |
end | |
for fn_name <- [:foo, :bar, :baz] do | |
defmacro unquote(fn_name)(do: inner) do | |
fn_name = unquote(fn_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Html do | |
defmacro markup(do: inner) do | |
quote do | |
{:ok, var!(buffer, Html)} = start_buffer | |
unquote(inner) | |
result = get_buffer(var!(buffer, Html)) | |
stop_buffer(var!(buffer, Html)) | |
result | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Html do | |
defmacro markup(do: inner) do | |
quote do | |
{:ok, var!(buffer, Html)} = start_buffer | |
unquote(inner) | |
result = get_buffer(var!(buffer, Html)) | |
stop_buffer(var!(buffer, Html)) | |
result | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Html do | |
defmacro markup(do: inner) do | |
{:ok, buffer} = start_buffer | |
quote do | |
unquote(inner) | |
end | |
buffer = get_buffer | |
stop_buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MacroPlayground do | |
defmacro para(ast) do | |
# 0. Store the pid of the current process | |
me = self | |
pids = Macro.prewalk(ast, fn | |
# 1. Pattern matching can be done with function arguments! | |
{:for, meta, args} -> | |
# 2. Extract the do block of the comprehension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ControlFlow do | |
defmacro para(for_comp) do | |
# 0. Store the pid of the current process | |
me = self | |
pids = Macro.prewalk(for_comp, fn | |
# 1. Pattern matching can be done with function arguments! | |
{:for, meta, args} -> | |
# 2. Extract the do block of the for comprehension |
- Open
/Applications/Mozart.app/Contents/Resources/bin/ozplatform
- Make it look like the following:
#!/bin/sh
echo "i486-darwin"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun dotspacemacs/user-config () | |
"Configuration function for user code. | |
This function is called at the very end of Spacemacs initialization after | |
layers configuration. | |
This is the place where most of your configurations should be done. Unless it is | |
explicitly specified that a variable should be set before a package is loaded, | |
you should place your code here." | |
(spacemacs/set-leader-keys-for-major-mode 'oz-mode | |
"sb" 'oz-feed-buffer | |
"sl" 'oz-feed-line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.fpinscala.errorhandling | |
object Foo { | |
def sequence[A](a: List[Option[A]]): Option[List[A]] = | |
// We need to destructure only because of the `Nil` | |
// case where we have to return None immediately. | |
a match { | |
case Nil => Some(Nil) /* Option[List[A]] map (List[A] => A :: List[A]) */ | |
case h :: t => h flatMap(hh => (sequence(t) map (x => hh :: x))) |