Skip to content

Instantly share code, notes, and snippets.

@ithayer
Created February 14, 2012 00:31
Show Gist options
  • Select an option

  • Save ithayer/1821879 to your computer and use it in GitHub Desktop.

Select an option

Save ithayer/1821879 to your computer and use it in GitHub Desktop.
(defmachine PaymentsMachine
(state :user-submitted
(on-in (fn [data]
(log/put "User submitted ...")
(send-email "..."))))
(state :sent-off
(on-in (fn [data]
(log/put "sent payment"))))
(state :error
(on-in (fn [data]
(log/put "...")))
(after 3 :days (fn [])))
(state :notified-user-of-error)
(state :complete)
(on :init (fn [data]
(if (valid? data)
(transition :user-submitted {:data ...}))))
(accepts :complete))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment