Created
February 1, 2012 08:11
-
-
Save rirakkumya/1715913 to your computer and use it in GitHub Desktop.
fold関数の使い方
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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