As the title says, your task is to print the largest string using the shortest code without taking any input value.
Rules
The program must take no input and print the largest string to STDOUT
The string must contain only ASCII Characters. If you don't know the ASCII Characters, take a look at the table
No Loops are allowed
No multiplication, exponentiation or any kind of elevation is permitted.
The score is measured by subtracting the amount of bytes of your code to the amount of bytes of your string. Example. My code is
60
Bytes and it generates an string of300
Bytes. My score will be300-60=240
The highest score wins.
Example
try{a.b}catch(e){alert(e)}
The output of my program is ReferenceError: a is not defined
= 32 bytes
My Score will be 32-26
= 6
Update
By Loops i mean any repetitive structure. For example for
, while
, do while
, recursive functions
etc..
2 Answers 2
R, 541-9 = 532
When passing a built-in function name to R, the console describes it parameters. I'm sure there are longer ones, but I went for the low-hanging fruit
Code:
.packages
Output:
function (all.available = FALSE, lib.loc = NULL)
{
if (is.null(lib.loc))
lib.loc <- .libPaths()
if (all.available) {
ans <- character()
for (lib in lib.loc[file.exists(lib.loc)]) {
a <- list.files(lib, all.files = FALSE, full.names = FALSE)
pfile <- file.path(lib, a, "Meta", "package.rds")
ans <- c(ans, a[file.exists(pfile)])
}
return(unique(ans))
}
s <- search()
invisible(.rmpkg(s[substr(s, 1L, 8L) == "package:"]))
}
<bytecode: 0x103fdf200>
<environment: namespace:base>
Edit: Thanks Giuseppe for the link
-
\$\begingroup\$ @dzaima seems right \$\endgroup\$2018年03月14日 18:43:45 +00:00Commented Mar 14, 2018 at 18:43
-
\$\begingroup\$ You can add a link to Try it online so we can verify your results! And welcome to R golfing, by the way :) \$\endgroup\$Giuseppe– Giuseppe2018年03月14日 18:47:53 +00:00Commented Mar 14, 2018 at 18:47
-
\$\begingroup\$ Wouldn't
help()
orimport this
have better code/output ratio? \$\endgroup\$manatwork– manatwork2018年03月14日 18:53:57 +00:00Commented Mar 14, 2018 at 18:53 -
\$\begingroup\$ @manatwork oh yeah thanks \$\endgroup\$2018年03月14日 19:18:26 +00:00Commented Mar 14, 2018 at 19:18
yes
by definition has ∞ output, though is not explicitly a loop in the shell language. Allowed? \$\endgroup\$P
scoresS
, then you can construct a program that scores2*S
by repeating the source ofP
twice. \$\endgroup\$