Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Dec 23rd, 2011  |  syntax: Clojure  |  size: 0.30 KB  |  hits: 95  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. (deftype game-map [xdim ydim contents]
  2.   clojure.lang.IPersistentVector
  3.   (assoc [this key val]
  4.     (game-map. xdim ydim
  5.               (assoc contents (+ (first key) (* (second key) ydim)) val)))
  6.   clojure.lang.IFn
  7.   (invoke [this col]
  8.           (get contents (+ (first col) (* (second col) ydim)))))