Created
May 4, 2015 21:39
-
-
Save schmmd/e33d58797133d6b705bf to your computer and use it in GitHub Desktop.
Quispy
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
#!/usr/bin/env scalas | |
/*** | |
scalaVersion := "2.11.5" | |
libraryDependencies += "com.github.rodneykinney" % "quisp_2.11" % "0.5.0" | |
*/ | |
import quisp.Plot._ | |
object Main extends App { | |
val primes = Stream.from(2).filter { n => | |
(2 until n).forall(m => n % m != 0) | |
} | |
println(primes.take(10)) | |
val pi = Iterator.from(0).map { x => | |
primes.takeWhile(p => p < x).size | |
} | |
val chart = line(pi.take(100).toSeq) | |
chart.title.text("Prime Counting Function") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment