Scala 3 -language:postfixOps
, 940 748 bytes
This is a chonky lizard.
@main def m:Unit=
val s="""@main def m:Unit=
val s=Q%sQ;var x=0;class main extends annotation.Annotation{def dval=print(420);def d=printf(s.replace(""+81.toChar,"\""*3),s,s)}
return
new main()dval
x=0
@main def n={val s=Q%sQ;printf(s.replace(""+81.toChar,"\""*3),s,s)}""";var x=0;class main extends annotation.Annotation{def dval=print(420);def d=printf(s.replace(""+81.toChar,"\""*3),s,s)}
return
new main()dval
x=0
@main def n={val s="""@main def m:Unit=
val s=Q%sQ;var x=0;class main extends annotation.Annotation{def dval=print(420);def d=printf(s.replace(""+81.toChar,"\""*3),s,s)}
return
new main()dval
x=0
@main def n={val s=Q%sQ;printf(s.replace(""+81.toChar,"\""*3),s,s)}""";printf(s.replace(""+81.toChar,"\""*3),s,s)}
x
is 420.
Try it online!
Try the first x bytes online!
Try the last (n-x) bytes online!
I'm sure I've done something silly here and can make it smaller, but it's really hard editing quines and seeing what's wrong, so I'll try golfing it more later.
First x bytes, prettified (...
contains the entire program):
@main def m: Unit =
val s = """..."""
var x = 0
class main extends annotation.Annotation {
def dval = print(420)
def d = printf(s.replace("" + 81.toChar, "\"" * 3), s, s)
}
return new main().d
Last (n-x) bytes, prettified (...
contains the entire program):
val x = 0
@main def n = {
val s = """..."""
printf(s.replace("" + 81.toChar, "\"" * 3), s, s)
}
A
andB
that outputAB
(A
andB
concatenated together). When that output is run as a program, it outputs the length ofA
. \$\endgroup\$