Mercurial > cortex
diff org/self_organizing_touch.clj @ 411:a331d5ff73e0
saving progress for the night. completed self-organizing touch, still working on stream predicates.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 18 Mar 2014 23:04:48 -0400 |
parents | e6a7e80f885a |
children | cc9957241076 |
line wrap: on
line diff
1.1 --- a/org/self_organizing_touch.clj Tue Mar 18 22:29:03 2014 -0400 1.2 +++ b/org/self_organizing_touch.clj Tue Mar 18 23:04:48 2014 -0400 1.3 @@ -80,8 +80,7 @@ 1.4 [coll] 1.5 (loop [result () coll (sort-by (comp - count) coll)] 1.6 (if (empty? coll) result 1.7 - (let [x (first coll) 1.8 - xs (rest coll) 1.9 + (let [[x & xs] coll 1.10 c (count x)] 1.11 (if (some 1.12 (fn [other-set] 1.13 @@ -91,12 +90,6 @@ 1.14 (recur result xs) 1.15 (recur (cons x result) xs)))))) 1.16 1.17 -(defn rect-region [[x0 y0] [x1 y1]] 1.18 - (vec 1.19 - (for [x (range x0 (inc x1)) 1.20 - y (range y0 (inc y1))] 1.21 - [x y]))) 1.22 - 1.23 (def all-touch-coordinates 1.24 (concat 1.25 (rect-region [0 15] [7 22]) 1.26 @@ -112,8 +105,7 @@ 1.27 data 1.28 [[(vec (keys touched-region)) (vec (vals touched-region))]] 1.29 touch-display (view-touch)] 1.30 - (touch-display data) 1.31 - (touch-display data))) 1.32 + (repeatedly 5 #(touch-display data)) data)) 1.33 1.34 (defn learn-touch-regions [] 1.35 (let [experiences (atom [])