L
Lloyd Zusman
In a ruby program I'm writing, I want to parse a string in reverse and
feed each of its individual characters through a state machine.
A "hammer and tongs" solution looks like this:
string.reverse.split(//).each {
|ch|
feedIntoStateMachine(ch)
}
However, this seems rather inefficient. Does anyone know of a faster
algorithm for this in ruby?
Thanks in advance.
feed each of its individual characters through a state machine.
A "hammer and tongs" solution looks like this:
string.reverse.split(//).each {
|ch|
feedIntoStateMachine(ch)
}
However, this seems rather inefficient. Does anyone know of a faster
algorithm for this in ruby?
Thanks in advance.