Skip to content

Instantly share code, notes, and snippets.

View reiddraper's full-sized avatar
🍹

Reid Draper reiddraper

🍹
View GitHub Profile
-module(amt).
-compile(export_all).
-type kv() :: {Key :: integer(), Value :: term()}.
-type tree() :: {tree, orddict:orddict()} | {value, kv()}.
-type either(A) :: {ok, A} | {error, term()}.
-spec empty() -> tree().
empty() ->
-module(amt).
-compile(export_all).
-type kv() :: {Key :: integer(), Value :: term()}.
-type tree() :: {tree, orddict:orddict()} | {value, kv()}.
-type either(A) :: {ok, A} | {error, term()}.
-spec empty() -> tree().
empty() ->
-module(iset).
-include_lib("eqc/include/eqc.hrl").
-export([empty/0,
singleton/1,
difference/2,
union/2,
member/2,
to_list/1]).
-module(iset).
-include_lib("eqc/include/eqc.hrl").
-export([empty/0,
singleton/1,
union/2,
member/2,
to_list/1]).
-compile(export_all).

!SLIDE

Monads in Erlang

monads are simple

!SLIDE

a monad is a monoid in the category of endofunctors

(require '[sumo.client :as sumo])
(require '[clojure.pprint :as pp])
;; make sure that allow_mult true is set on this bucket first
(def client (sumo/connect-pb))
;; make sure ping is working
(sumo/ping client)
;; true
@reiddraper
reiddraper / fsm.markdown
Created August 17, 2012 19:20
FSM Strawman

FSM Strawman

I've been thinking about some of the shortcomings of gen_fsm, and some common FSM actions I've either implemented myself, or seen my FSMs suffer from not having. I've been playing around with a couple ideas for alternative ways to describe an FSM that would still be driven by gen_fsm. This is the the first concrete idea I've come up with, but it certainly still is far from completely fleshed out. That said, I think there's enough to start getting feedback.

on the guest SmartOS VM

pkg_add http://pkgsrc.joyent.com/sdc6/2012Q1/i386/All/smtools
# note this is going to shut down the VM
sm-prepare-image

on the global zone

I've been playing more with this Erlang factoring technique. As an exercise, I've been trying to force myself to adopt the method, by writing functions that are 3 or less lines long (function clauses actually, so multiple pattern-matched claues are OK).

Death to receive expressions

One place I noticed was causing myself

Riak Users,

I've been working on some new features for Riak's secondary indexes (2i), and I wanted to get some feedback from the community before proceeding much further.

How does 2i work currently?

2i lets you query index values with