Mercurial > cortex
comparison org/vision.org @ 171:15bde60217aa
updated docstring for vision-fn
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 04 Feb 2012 05:02:25 -0700 |
parents | 1a00b4918529 |
children | 04a39e6bb695 |
comparison
equal
deleted
inserted
replaced
170:1a00b4918529 | 171:15bde60217aa |
---|---|
183 :red 0xFF0000 | 183 :red 0xFF0000 |
184 :blue 0x0000FF | 184 :blue 0x0000FF |
185 :green 0x00FF00}) | 185 :green 0x00FF00}) |
186 | 186 |
187 (defn vision-fn | 187 (defn vision-fn |
188 "return [init-function sensor-functions] for a particular eye" | 188 "Returns a list of functions, each of which will return a color |
189 channel's worth of visual information when called inside a running | |
190 simulation." | |
189 [#^Node creature #^Spatial eye & {skip :skip :or {skip 0}}] | 191 [#^Node creature #^Spatial eye & {skip :skip :or {skip 0}}] |
190 (let [retinal-map (retina-sensor-profile eye) | 192 (let [retinal-map (retina-sensor-profile eye) |
191 camera (add-eye! creature eye) | 193 camera (add-eye! creature eye) |
192 vision-image | 194 vision-image |
193 (atom | 195 (atom |
231 (reduce | 233 (reduce |
232 concat | 234 concat |
233 (for [eye (eyes creature)] | 235 (for [eye (eyes creature)] |
234 (vision-fn creature eye)))) | 236 (vision-fn creature eye)))) |
235 | 237 |
236 | |
237 #+end_src | 238 #+end_src |
238 | 239 |
239 | 240 |
240 Note the use of continuation passing style for connecting the eye to a | 241 Note the use of continuation passing style for connecting the eye to a |
241 function to process the output. You can create any number of eyes, and | 242 function to process the output. You can create any number of eyes, and |