 	      s] ; sample size
   (let [canvas (gen-canvas n w target)
 	tiles (sample-tiles s (gen-tiles n source))]
-    (map #(insert!
-	   (:tile (best-match n tiles (tile % canvas)))
-	   canvas (first %) (second %))
-	 (grid n (.getWidth canvas) (.getHeight canvas)))
+    (dorun (map #(insert!
+		  (:tile (best-match n tiles (tile % canvas)))
+		  canvas (first %) (second %))
+		(grid n (.getWidth canvas) (.getHeight canvas))))
     canvas))
 
 

  "Insert image a into image b at coordinates dx,dy."
  (let [da (.getRaster a)
	db (.getRaster b)]
    (for [x (range 0 (.getWidth da))
	  y (range 0 (.getHeight da))
	  z (range 0 (.getNumBands da))]
      (.setSample db (+ dx x) (+ dy y) z
		  (.getSample da x y z))))
  nil)

(defn mosaic [^BufferedImage source
	      ^BufferedImage target

(defn gen-tiles [n ^BufferedImage b]
  "Generate tiles of size n from image b.
   Returns a list of BufferedImages."
  (map tile (grid n (.getWidth b) (.getHeight b)) (repeat b)))

(defn save-image [^BufferedImage b ^String f]
  "Save a BufferedImage to filename f."
