Skip to content

Instantly share code, notes, and snippets.

@jabley
Forked from marick/gist:1226882
Created September 19, 2011 16:24
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 jabley/1226883 to your computer and use it in GitHub Desktop.
Save jabley/1226883 to your computer and use it in GitHub Desktop.
(ns scratch.core
(:use midje.sweet
[clojure.set :only [union intersection]]
))
(unfinished booking-transaction bookings)
(defn empty-history []
[ [] ])
(defn bookings [history]
(last history))
(defn booking-transaction [history booking]
(conj history (conj (bookings history) booking)))
;.;. Achievement is its own reward. -- David Lynch
(facts "about the insert-animal transaction"
"inserting an animal into the empty database adds that animal"
(bookings (empty-history)) => []
(let [new-history (booking-transaction (empty-history) [...animal...])]
(bookings new-history) => [ [...animal...] ]
(let [newer-history (booking-transaction new-history [...fred... ...betsy...])]
(bookings newer-history) => [ [...animal...] [...fred... ...betsy...] ])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment