From: "A. S. Bradbury" Date: 2006-09-10T20:52:25+09:00 Subject: How about Enumerable#find_pattern? Ignore the name, I don't really know what it's best to call it. Basically I've been thinking it might be useful if Enumerable had a method to efficiently search for a pattern in an Enumerable object. Existing methods like #find and #grep work only on matching a single object. This method might be implemented using the Knuth-Morris-Pratt algorithm (http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm). It just seems to me that it's a useful feature for Enumerable objects to have. A brute force search is easy using #each_cons, and of course users can write their own KMP-based searches, it just strikes me as something that has general utility. There'd need to be one to return all matches and another to return only the first. The method should return the position of the start of the match. Comments? Alex