Published on [Permalink]
Reading time: 4 minutes

Styles of perception: predator and prey

In the first prototype (perhaps to be described later), I adopted what I think of as a predator approach to perception. In the next prototype, I’m going to switch to a prey approach.

Necessary background: in the prototype, the app-animal is focused on a single paragraph within a script. It’s focused there because that’s the paragraph that contains the cursor (insertion point). But what does “focused” mean?

For the predator approach, think of a cat carefully watching a mouse hole. It’s tightly focused, looking in a specific spot for something that will afford pouncing. So imagine a process that’s watching to see if “Brian” (the user) has split a paragraph into two halves. It would watch the cursor carefully, noting any new characters typed. If it sees a newline being typed and it remembers that the previous inserted character was also a newline, it reacts to the split paragraph. When thinking about that design, I deliberately left aside the question of what should happen if Brian types a newline, moves the cursor to another place, types a few non-newline characters, returns to just after the existing newline, and types another. My reasoning was: “I bet that will never happen – I know how ‘Brian’ customarily splits paragraphs, and that ain’t it.” So I decided to worry about that only if I were forced to.(The app-animal has perceived an affordance.)

In contrast to predators, prey tend more to ambient awareness. Such animals tend to have a very wide field of vision. Cattle, for example, can see through a 300 degree arc. They use that wide field of vision to notice any movements that might reveal a predator. Rather than looking into the environment, they wait for the environment to surprise them, at which point they start looking more closely to decide if the danger is real. “Ambient awareness” seems to be a term used in sociology and teamwork talk, not so much in biology, but it’s such a great term that it shouldn’t be restricted to Homo sapiens in social situations.

For the app-animal, I want it to “scan the environment”, meaning periodically searching the text of the paragraph, looking for the regular expression /\n\n+/. It’s not really right to think of prey as scanning their environment, rather than having a whole lot of neurons looking – in parallel – for significant movement, but I don’t want to implement crazily parallel algorithms: it’s too hard. This appeals to me, because our real visual system has specializations to detect edges, and you can sort of imagine a regular expression searching for the edge between a block of text and vertical blank space.

Detecting edges in a paragraph: text is a plateau, whitespace is a valley. Content is erased; all that matters is transitions.

What should trigger the scanning? I’m fine with a timer triggering it every few seconds, perhaps only if there’ve been no characters typed for a little while. In general, I rather dislike editors that pull such tricks to show code completions, documentation, or error messages. (Looking at you, eldoc and flymake, at least in default form.) But that’s because such tools SHOUT AT ME and distract me. I, as programmer, will insist the app-animal’s changes to Brian’s visual field will be more discrete. For example, “Oh, I see you’re doing a major edit to a paragraph; I am ready to offer help” will be indicated by something like a subtle change to border color.)

Periodic checks are biologically plausible. The brain is fond of rhythm. I mentioned in the rabbit episode that the reinforcing activation in the rabbit’s olfactory bulb is synced up to the frequency of the rabbit’s sniffing. Moreover, the brain has processes called oscillators that emit signals to “clients” at fixed intervals. There are even oscillators that can vary their period to sync up with periodicities in the environment. (For all I know, that’s how the rabbit neurons sync up with the sniff rate.)

Until I decide among various ways to do comments for this blog, here’s a Mastodon post to reply to.