Skip to content

Instantly share code, notes, and snippets.

@StoneCypher
Last active February 26, 2018 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StoneCypher/080a60476a7dfdf15ea28df71c31eaf6 to your computer and use it in GitHub Desktop.
Save StoneCypher/080a60476a7dfdf15ea28df71c31eaf6 to your computer and use it in GitHub Desktop.
machine_name: "Raganwald's example";
machine_source: http://raganwald.com/2018/02/23/forde.html ;
start_states: open;
initial_data: { balance: 0 };
open 'deposit' { onfollow: `${(action, data) => ((data.balance += action.amount), data)}`; } -> open;
open 'withdraw' { onfollow: `${(action, data) => ((data.balance -= action.amount), data)}`; } -> open;
open 'place_hold' -> hold 'remove_hold' -> open;
[open hold] 'close' { onfollow: `${...}`; } -> closed;
close 'reopen' -> open;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment