!SLIDE
monads are simple
!SLIDE
a monad is a monoid in the category of endofunctors
-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). |
(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 |
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.
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).
One place I noticed was causing myself