Skip to content

Instantly share code, notes, and snippets.

@rirakkumya
Created February 1, 2012 08:11
Show Gist options
  • Save rirakkumya/1715913 to your computer and use it in GitHub Desktop.
Save rirakkumya/1715913 to your computer and use it in GitHub Desktop.
fold関数の使い方
def hb(i1:String,i2:String) = (i1 zip i2).foldLeft((0,0)){(a, b) => if(b._1 == b._2) (a._1+1,a._2) else (a._1,a._2+1)}
def s(n:Int) = (1 to n).foldLeft(List("")){(l,_) => List("A","C","G","T").flatMap(x => l.map(_ + x))}.filter(_.contains("AAG"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment