Created
October 6, 2021 19:33
-
-
Save pfcoperez/41aa641c516f8d8286058bfd77380214 to your computer and use it in GitHub Desktop.
A quine using Scala as an Ammonite script
This file contains hidden or 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
var l = Vector.empty[String] | |
val c = '"' | |
def doit(p: => Unit) { | |
p | |
val ll = "doit {" +: l :+ "}" | |
print(ll.mkString("\n")) | |
} | |
def myprint(x: Any) { | |
l = l :+ s"myprint($c$c$c$x$c$c$c)" | |
println(x) | |
} | |
doit { | |
myprint("""var l = Vector.empty[String] | |
val c = '"' | |
def doit(p: => Unit) { | |
p | |
val ll = "doit {" +: l :+ "}" | |
print(ll.mkString("\n")) | |
} | |
def myprint(x: Any) { | |
l = l :+ s"myprint($c$c$c$x$c$c$c)" | |
println(x) | |
}""") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment