Testing:


(ns inventory.core-test
  (:require [clojure.test :refer :all]
            [inventory.core :as i]))

(def books
   [{:title "2001"   :author "Clarke" :copies 21}
    {:title "Emma"   :author "Austen" :copies 10}
    {:title "Misery" :author "King"   :copies 101}])

(deftest test-finding-books
  (is (nil? (i/find-by-title "XY" books))))

(deftest test-finding-books-2
  (is (not (nil? (i/find-by-title "Emma" books))))
  (is (nil? (i/find-by-title "XY" books))))

def eval(x, poly):
    '''Evaluate at x the polynomial with coefficients given in poly'''
    sum = 0
    while 1:
        sum = sum + poly[0]     # Add the next coef.
        poly = poly[1:]         # Done with that one.
        if not poly: break      # If no more, done entirely.
        sum = sum * x           # Mult by x (each coef gets x right numtimes)
    return sum