comparison clojure/com/aurellem/gb/hxc.clj @ 252:2b6bd03feb4f

minor correction.
author Robert McIntyre <rlm@mit.edu>
date Mon, 26 Mar 2012 04:03:19 -0500
parents 99227bec1123
children b2f9a0cb13e3
comparison
equal deleted inserted replaced
251:40b5bff9576c 252:2b6bd03feb4f
329 329
330 (defn search-map [proto-map maps] 330 (defn search-map [proto-map maps]
331 "Returns all the maps that make the same associations as proto-map." 331 "Returns all the maps that make the same associations as proto-map."
332 (some (partial submap? proto-map) maps)) 332 (some (partial submap? proto-map) maps))
333 333
334 ;; (I don't use this for anything so far.) 334 (defn filter-vals
335 ;; 335 "Returns a map consisting of all the pairs [key val] for
336 ;; (defn filter-vals 336 which (pred key) returns true."
337 ;; "Returns a map consisting of all the pairs [key val] for which (pred 337 [pred map]
338 ;; key) returns true." 338 (reduce (partial apply assoc) {}
339 ;; [pred map] 339 (filter (fn [[k v]] (pred v)) map)))
340 ;; (reduce (partial apply assoc) {} (filter (fn [[k v]] (pred v)) map)))
341 340
342 341
343 (defn search-moves 342 (defn search-moves
344 "Returns a subcollection of all hardcoded moves with the given 343 "Returns a subcollection of all hardcoded moves with the
345 attributes. Attributes consist of :name :power :accuracy :pp :fx-id 344 given attributes. Attributes consist of :name :power
346 (and also :fx-txt, but it contains the same information as :fx-id)" 345 :accuracy :pp :fx-id
346 (and also :fx-txt, but it contains the same information
347 as :fx-id)"
347 ([attribute-map] 348 ([attribute-map]
348 (search-moves com.aurellem.gb.gb-driver/original-rom attribute-map)) 349 (search-moves
350 com.aurellem.gb.gb-driver/original-rom attribute-map))
349 ([rom attribute-map] 351 ([rom attribute-map]
350 (filter-vals (partial submap? attribute-map) (hxc-move-data 352 (filter-vals (partial submap? attribute-map)
351 rom)))) 353 (hxc-move-data rom))))
352 354
353 355
354 356
355 357
356 358