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
let val plus = \(n:nat) \(m:nat) rec m { | |
z => n | |
| s(x) with y => s(y) | |
} | |
in let val pred = \(n : nat) rec n { | |
z => z | |
| s(x) with y => x | |
} | |
in let val minus = \(n:nat) \(m:nat) rec m { | |
z => n |
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
%% Date formats in Erlang are a bit tricky to keep straight, | |
%% especially since the `calendar' library leverages Gregorian seconds | |
%% (seconds since year 0) rather than the more traditional UNIX epoch | |
%% seconds. | |
%% | |
%% This module illustrates the structures and conversions. | |
-module(erlang_dates). | |
-compile(export_all). |
Papers on Chain Replication
- Chain Replication for Supporting High Throughput and Availability; Robbert van Renesse, Fred B. Schneider; 2004
- Object Storage on CRAQ: High-Throughput Chain Replication for Read-Mostly Workloads; Jeff Terrace and Michael J. Freedman; 2009
- FAWN: A Fast Array of Wimpy Nodes; David G. Andersen, Jason Franklin, Michael Kaminsky, Amar Phanishayee, Lawrence Tan, Vijay Vasudevan; 2009
- Chain Replication in Theory and in Practice; Scott Lystig Fritchie; 2010
- HyperDex: A Distributed, Searchable Key-Value Store; Robert Escriva, Bernard Wong, Emin Gün Sirer; 2012
- [ChainReaction: a Causal+ Consistent Datastore based on Chain Replication](http://others.keleher
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
This gist captures what needs to be done to add a new field to Riak's Yokozuna | |
search index. | |
Sources: | |
- https://github.com/basho/yokozuna/issues/130 | |
- http://riak-users.197444.n3.nabble.com/How-to-update-existed-schema-td4032143.html | |
The code below is for illustration purposes only. Use at your own risk. | |
1. Create/Update new schema file |
I think of Schema as a runtime contracts library (I believe it does coercion and validation, but they seem related to me).
- small barrier to entry, thus immediately useful
- just add a contract/coercion to a function and you're off
- can manipulate contracts as regular clojure data
- documentation
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
(require '[clojure.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
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
%% @doc Reports on percentage of modules, functions and types that are | |
%% documented. | |
-module(edoc_stats). | |
-export([file/1, file/2, files/1, files/2, aggregate/1, report/1, report_files/1, report_files/2]). | |
-include_lib("xmerl/include/xmerl.hrl"). | |
-import(xmerl_xpath, [string/2]). | |
-define(QUERY_FUNS, [ fun module_has_description/2 | |
, fun functions_have_descriptions/2 | |
, fun types_have_descriptions/2 |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
module FizzBuzzC | |
%default total | |
-- Dependently typed FizzBuzz, constructively | |
-- A number is fizzy if it is evenly divisible by 3 | |
data Fizzy : Nat -> Type where | |
ZeroFizzy : Fizzy 0 | |
Fizz : Fizzy n -> Fizzy (3 + n) |
NewerOlder