 (defn titanic
   "Implements the titanic algorithm. weigh must return for a
   collection of sets a hash-map mapping every set to its weight, with
-  max-weight being the maximal weight possbile. weight-minimum is a
-  function of one argument being a sequence of weights and returning
-  the minimal of those."
-  [base-set weigh max-weight weight-minimum]
-  (binding [closure       {},
-            set-weight    (weigh [#{}]),
-            subset-weight (partial subset-weight max-weight),
-            minimum       weight-minimum]
+  max-weight being the maximal weight possible. weight-order denotes
+  the order on the weights. Note that this order has to be linear for
+  this implementation to work."
+  [base-set weigh max-weight weight-order]
+  (binding [closure    {},
+            set-weight (weigh [#{}]),
+            minimum    (partial minimum weight-order max-weight)]
 
     (loop [key-set    #{#{}},
            candidates (set-of #{m} [m base-set]),

        Y))))

(defn- titanic-generate
  "Computes the next candidate set."
  [base-set key-set]
  (set-of next [A key-set,
                m (difference base-set A),

 "Implements the TITANIC algorithm. Note that this implementation is
 not tune for speed but for flexibility.")

(set! *warn-on-reflection* true)

;;; Pragmatics

(defmacro- set-val!
