Tuesday, 20 October 2009

Checking how to use blogger for side by side code comparison

I had to change the Blogger HTML template to do this.
.post {
padding-$startSide:0%;
padding-$endSide:0%;
}


                                                                                
object Primes {

def primes = {
  def sieve(is: Stream[Int]): Stream[Int] = is match { 
case p #:: xs => p #:: sieve(for (x <- xs if x % p > 0) yield x)
}
sieve(Stream from 2)
}

def main(args: Array[String]) {
primes take 100 foreach println
}
}


                                                                                
object Primes {

def primes = {
def sieve(is: Stream[Int]): Stream[Int] = is match { 
case p #:: xs => p #:: sieve(for (x <- xs if x % p > 0) yield x)
}
sieve(Stream from 2)
}

def main(args: Array[String]) {
primes take 100 foreach println
}
}
Post a Comment