[racket] Is there a better way to do this in Racket?

From: Danny Yoo (dyoo at hashcollision.org)
Date: Sun May 13 17:37:24 EDT 2012

> The problem "feels" like a state machine problem, in that we can
> imagine a machine in either one of two states: we're searching for the
> start of a sequence of ones, or looking for the end of a sequence of
> ones.  We can represent being in a state via function call.  The
> following code is one way to do so:

Gah... typos in the comments.  There should be a self-loop in the
scanning-for-end, and "bound" should be "bounce".  Sorry: I didn't
unit test the comments.  :)


Posted on the users mailing list.