Harry Spier wrote at 05/13/2012 04:47 PM:
Is there a better way to do this iin Racket (shorter, clearer, more readable)?
If this you are doing large numbers of this operation, and you are performance-sensitive, I suggest that one of your top criteria for ``better'' should be *efficiency*.
From a glance, I think you could do this more efficiently, even if you don't use bit-banging tricks. For doing this efficiently without bit-banging, I suggest keeping this mantra in mind: "minimize consing". That's far from the only advice or even best advice, but I think it's a good place to start in this case. I mention it because you are doing some good things in your code, and I think now is the time to be thinking more about consing. ("Consing" is when a pair is allocated by Racket, and is an old, simplified model for reasoning about allocation and performance in Lisps. "cons" allocates one pair; "list", "reverse", "append", etc. allocate many pairs.)
After you change the code for reduced consing, you can look at smaller things in that code, like whether you're doing any tests or other computation redundantly, whether "vector-ref" is faster than some stream/iterator abstraction, Boolean algebra reduction, etc.
If you don't care about optimizing this, then I suspect people will push you in different directions than I would.
Neil V. ____________________ Racket Users list: http://lists.racket-lang.org/users

