All pastes #630245 Raw Edit

Unnamed

public ruby v1 · immutable
·published 2007-07-23 01:01 UTC
rendered paste body
    def find_smallest_n(i : Int, s : Iterator[Char]) = {        val dna_i = dna drop (i + 1);	val postfix = s.toList	var n = i - 1;	def find_n(d : Iterator[Char]) : Unit = {		d dropWhile { a => n += 1; a != postfix(0) }		if (!(d.buffered startsWith postfix)) {			n += 1			find_n(d drop 1)		}	}	find_n(dna_i)	if (n == i - 1 || !(dna hasNext)) None else Some(n)    }