New answers tagged

6

286 256 251 247 244 240 bytes [+[[+[++[[]][+[]]+[++[[]][+[]]]+[[][[]]+[]][+[]][++[[]][+[]]+[++[[]][+[]]][+[]]+[++[[]][+[]]][+[]]]+[++[[]][+[]]]+[+[]]+[+[]]]+[]][+[]][++[[]][+[]]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[++[[]][+[]]]]+[]][+[]][++[[]][+[]]+[++[[]][+[]]][+[]]] Did I just outgolf @Arnauld in his favorite language despite barely knowing JS?! ;) ...


11

260 ... 216  210 bytes [+[[+[++[[]][+[]]+[++[[]][+[]]]+[[][[]]+[]][+[]][++[++[++[[]][+[]]][+[]]][+[]]]+[++[[]][+[]]]+[+[]]+[+[]]]+[]][+[]][++[[]][+[]]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[+[]]+[++[[]][+[]]]]+[]][+[]][++[++[[]][+[]]][+[]]] Try it online! How? We first generate the string "11e100" and coerce it to an number to get 1.1e+101. By coercing ...


0

Japt, 6 bytes `6 ßs Try it online! Alternative 8-byte solution: Japt, 8 bytes #+` ßs Try it online! Contains an unprintable character between the # and +. Character codes: 35, 8, 43, 96, 32, 223, 26, 115


1

x86 machine code (32-bit), 43 bytes ` !Q !j !Y_j Q░x≤¬ 'YX¬A╢ Ç∙ëq∞Çε ê7af║█¡├ (in codepage 437; see disassembly below for hex-dump of the code) A fastcall function which receives the pointer to output buffer in ecx. It fills the buffer with a triangle containing the letter x: x xx xxx xxxx xxxxx xxxxxx xxxxxxx xxxxxxxx Disassembly: 10013FF0 60 ...


1

x86-16 machine code, IBM PC DOS, 6 bytes Binary (CP437): ░@@═)├ Unassembled listing: B0 40 MOV AL, '@' ; One below ASCII 'A' 40 INC AX ; increment char CD 29 INT 29H ; write AL to console C3 RET ; return to DOS


2

Stax, 4 bytes 2 mR Run and debug it at staxlang.xyz! Nontrivial solution. Prints "\x01\n\x01\x02", so you won't see any output, but it's there. One byte is easy but boring. 2 Push 2 mR For n in [1,2], print [1..n] as a string Another 4-byter that feels like cheating: 0 Do nothing |? Source of program, implicit print.


1

Perl 5 + -Mfeature+say, 14 bytes Relies on a generated program, so TIO link is to Bash which generates the program from xxd output. Uses -Mfeature+say instead of -M5.10.0 although I don't think it matters that much... say~"ÎËß" Try it online!


1

Golfscript, 12 bytes 6 6+" bytes" Try it online!


0

MAWP 0.1, 1 byte : Outputs top of stack, which is predefined as 1


1

Javascript, 15 bytes j=>0xf+' bytes' Seems like the obvious answer. Alternative: j=>9+6+' bytes'


1

C# (Mono C# Shell), 27 bytes Console.Write(3*9+" bytes") Try it online!


1

International Phonetic Esoteric Language, 13 bytes " bytes"94suo Explanation: " bytes" (push the string) 94s (push 13 by adding) uo (print twice) Alternative (also 13 bytes): " bytes"{D}uo (D == 13 base 36)


0

Google Sheets/Excel (15 bytes) Assuming your localization is in English: =MID(2=3,2,2/2) Note: this will not work on LibreOffice because it will change FALSE to 0 instead of "FALSE".


0

AlphaBeta, 64 bytes cccccccaaCLkgDLihhhDLLgggDLddddCLcccccaaaaaCLDLgggDLjggggDLjggDL Try it online!


0

MAWP, 97 89 bytes 98W;55W4W1M;93W4W;93W4W;94W1M3W;58W4M;84W;98M5W64AM;94W1M3W;99M1M6W;93W4W;55W4W;964AM3W;. Meets two of the requirements


0

SNOBOL4 (CSNOBOL4), 59 bytes N S =S ' ' CHAR(43) ' ' INPUT :S(N) O OUTPUT =EVAL(0 S) END Try it online!


0

Ruby & Perl 5 + -M5.10.0, 29 bytes s=a=y=$> .write a=?a ,?b ,?c abc in Ruby, error in Perl This sets the variables s, a and y to the result of writeing a=?a ,?b, ?c (equivalent to 'abc' as ? defines a character literal and write accepts multiple arguments) to $> ($> points to STDOUT by default). say$ wie =a,b,c abc in Perl, error in Ruby This ...


1

Rust / Python 3, 70 bytes Full (Rust) const _:i8= 3;//1 ; p r i n t ( " a b c " ) # fn main(){print!("abc")} Skipped (Python): cnt_i=3/1;print("abc")#f an)pit(ac) Rust fails on the skipped version with error: unexpected closing delimiter: `)` --> a.py:1:28 | 1 | cnt_i=3/1;print("abc")#f an)pit(ac) | ...


1

05AB1E / MathGolf, 13 bytes/bytes "aabbccc"1FÙ; Try it online in 05AB1E (outputs abc). Try it online in MathGolf (errors). Every second character: "abc"F; Try it online in 05AB1E (errors). Try it online in MathGolf (outputs abc). Explanation: # Full program in 05AB1E: "aabbccc" # Push string "aabbccc" ...


2

Python 3 and Befunge-98, 36 bytes z= print("@ , , , ""a b c "[8: :2] ) Works in Python: z= print("@ , , , ""a b c "[8: :2] ) "@ , , , " #String literal "a b c " #The second string literal is concatenated to the first [...


2

Brainetry, 143 bytes a b c d e f a b a b c d e f a b c d e f g h a b c d e f g h a b c d e a b c d a a b c d e f g h i a b c d e f a b c d e f g h i a b c d e f g To try it online follow this repl.it link and paste the code in the btry/replit.btry file, then press the green "Run" button. Does I/O as ASCII codepoints. The program above is the ...


0

C++ (clang), 81 75 bytes [](auto x){decltype(x)r;for(int a:x)r.insert(r.end(),a,0);return r.size();} I used a generic lambda to avoid the need for #include. It uses a temporary container, to which it appends lists of zeros of needed lengths. The output is the length of the resulting list. Thanks to S.S. Anne for the idea of using decltype! I used auto ...


2

SuperMarioLang, 235 bytes Why does this language exist? +>+>)+)+)+++)++++((((-[!)>->. +"+"===================#+".") +++!((+++++++++)++++++)<.---+ ++=#===================")---. ++((.-(.)).+++..+++++++.<--- !+======================--- =#>++++++++++++++.).+++.-!>! =======================#=# Try it online!


0

Python 3, 5 solutions (a program, three functions and a default-value variable) I see there's already a Python 3 answer, but I thought I'd try and make another one anyway. Or should it have been a comment? exec("p\x72\x69\x6e\x74(\x69\x6epu\x74())") # reads a line from standard input and writes it to standard output, the code has most letters ...


1

Microsoft Excel, 178 131 chars Uses the following cells: A1 - =0=0 TRUE. Since we don't need a real "1", we can just abuse coercion. A2 - =A1+A1 TRUE + TRUE = 2 A3 - =A2+A1 2 + TRUE = 3 A4 - =A3+A1 3 + TRUE = 4 A6 - =A4+A2 4 + 2 = 6 A8 - =A6+A2 6 + 2 = 8 A9 - =A8+A1 8 + TRUE = 9 B8 - =A4&A2 42 B9 - =A3&A3 33 B1 - =PROPER(BASE(A8&...


2

Microsoft Excel, 167 166 114 113 77 50 49 chars The other submission breaks two rules automatically with CHAR(), so I thought it would be better to post my own solution. This is the golfed version, which is arguably obfuscated on its own: =PROPER(BASE(345405,3^3)&"o "&BASE(59*930563,36)) Breaks only rule 2 with [EOR01]. There are no [HWLD] ...


1

Zsh, 4 functions/math functions ()((argv)) # bind as a math function int # math function from zsh/mathfunc echo -E - $@ # string arg to stdout <&0 # stdin to stdout Try it online! This is with zmodload zsh/mathfunc for int. This is not the only combination of 4 functions, ...


0

Brainetry, 141 bytes a b a b c d a b c d e f g h a b c d a b c d e f g h a b c a b c d e f g h i a b a b a b c d a b c a b c d a b c d e f g h i a b a b c d e f g The code above is the golfed version of this program: Hey, look, I'm not even going to try, ok? I will jvst write regvl@rly @nd then svbstitvte the letters yov do not w@nt me to vse. Is this ok@...


2

Brainetry, 1 program 1 is the maximum score attainable by the Brainetry programming language. The programs below are cat programs, they take any user input and output it unchanged. a b c d e f a b c d e f g h a b c d e f g a b c d e f a b c d e f g h i Brainetry is partially symbol independent but it needs spaces to understand what instruction each line ...


4

R, 11 programs firstly, in R, any expression that isn't assigned somewhere is printed by default, so the empty program counts (it will return an integer unchanged, for example) c can be treated as a function of one argument that will return it unchanged. I adds a class attribute, but this does not affect the printing. identity will return its argument. ...


2

J, 13 functions Either [ and ] return their arguments. > removes their argument from a box. Strings and integers don't have boxes. Rank 0 Array (characters or integers) =/ acts on a more than length 1 array. Rank 0 arrays are always length 1. Positive Integers | is magnitude, which is abs(x) in Python. Does nothing for positive integers. + is ...


0

i like frog, 37 bytes like frog i like i like frog i frog i I like outputs the parameters after converting the parameters to binary. The params work like this: If the last used word was "i" 0 = like 1 = frog If the last used word was "like" 0 = i 1 = frog If the last used word was "frog" 0 = i 1 = like This can be simply converted back to binary....


0

Java, 2 functions x->x A lambda function. Function.identity() This returns the identity function. Without the letters e and t, we can't use any of the {byte,char,short,int,long}Value, valueOf or toString methods.


1

Scala, 9 functions x=>x A lambda function. math.abs A utility function from the math package. For the following functions, we use the fact that methods on objects can be converted to functions if no arguments are given. 1* 0+ 2-2| // bitwise or with (2-2) ~(8&4)& // bitwise and with ~(8&4) 3^3^ // bitwise xor with (3^3) Nil:::...


1

Rust, 2 functions |x|x i8::abs Sadly, the colon is needed for all other ways to define a function.


1

Clojure, 8 functions They are: + * / -> do max str (fn[n]n) Arithmetic operations in Clojure are variadic functions that when given only one argument return it unchanged, and thus work as identity functions for numerics. Minus is an exception, because with one argument it becomes unary negation. But in its place we can use threading macro ->, which ...


2

PHP, 6 programs (functions) abs fn($n)=>$n iNtvAl chop HeBreV TRIm Try it online! We're taking advantage of PHP looseness about functions lower/upper case and types (all these fall into first case: taking an integer and return it unchanged), still searching for more


2

Brachylog, 22 bytes İḷ|f{;.P∧Ạ{∧Ṇ}ᶻ∋P∧|}ᵐ| Try it online! try it online! TRY IT ONLINE! I had some bizarre errors trying to use subscripted ∋/∈. Takes a string through the input variable and outputs through the output variable, since printing is impossible without lowercase letters. İ The input is an integer, but it's not, ḷ ...


4

APL (dzaima/APL), 38 functions/programs The code to be counted is parenthesised below. The first two entries are full programs, the rest are tacit prefix functions, except {⍵} which is a prefix lambda. (⎕) ⍝ prompt for numeric input and implicitly print it (⍞) ⍝ prompt for string and implicitly print it (⍮)I ⍝ 1-element with (no visual difference on simple ...


2

Befunge-98 (PyFunge), 51 bytes <aaA^:~@# , >-\:'``\'{^ ^ 1>\:'@`\'[>\`**' *+ ^ 01> Try it online! Try it online! (Uppercase letter removed) Try it online! (Lowercase letters removed) Explanation Without removing any characters, most of the code is never executed. The code that does get executed is < ^:~@# , ^ ^ > This reads each ...


5

Haskell, 5 6 programs 1: id Haskell has an identity function, so that is a good start. It uses i and d which are not terribly valuable anyway. 2: k x=x A simple definition of an identity. It uses = which is going to make it hard for us to define any new functions (instead we will have to build them). And it also uses the space which is would be ...


6

Brain-Flak, 252 programs The first 5 programs are: [] () <><> #{} and the empty string. These programs have 9 unique characters total. Each of the remaining 247 programs consist of an individual byte other than (){}<>{}#. How? In brain-flak, an empty program prints it's input. Any character other than #(){}[]<> has no affect on ...


1

PHP (224 Bytes) <?=!fPassthru(STDIN)&&0;__HALT_compiler();FUNCTIONfunction fPassthru(){returnRETURN STDIN;};functionFUNCTION __HALT_compiler(){ECHOecho STRTOUPPERstrtolower(STREAMstream_GETget_CONTENTScontents(Pfopen('php://stdin','r')));} Uppercase version <?=!P(STDIN)&&0;__HALT_(...


3

AWK, 21 22 24 25 26 programs Edit: thanks to Abigail for duplicate-letter-spotting and for the suggestion that led to l^l! Edit: +2 +3 more programs thanks again to Abigail Awk will print the input line by default if a condition evaluates to TRUE. non-zero values that evaluate to TRUE: 1 2 3 4 5 6 7 8 9 experessions that evaluate to TRUE: $0 # only ...


15

05AB1E, 130 133 144 148 150 151 155 156 157 159 programs Uses the custom 05AB1E encoding for all programs. All programs are a TIO-link to verify them. Either type of input is fine: 1) (empty program): Implicit input is output implicitly 2,3) (a space), \n (a newline): The whitespaces are ignored; implicit input is output implicitly (with trailing ...


5

Brachylog, 88 programs I doubt this is the longest I can get it, as I'm only posting this now because I need to take a break from making more of these, and if character lists are admissible for strings I know this can be expanded even further. The reason so many one-character solutions exist is that Brachylog has a lot of variables, constraint predicates, ...


1

str, 19 programs This is a very flexible language, because the empty program works, and there are a lot of no-op functions, or things that can be combined into no-ops. All of these are programs taking strings as input. The empty program A space character A tab character A newline character . (this and the whitespace above explicitly do nothing) ; (the ; ...


4

Python 3, 4 programs Python turned out to be much harder than I thought, with only 4 so far. int abs repr (1).__mul__ Try it online!


6

Stack Cats, 19 programs All programs that are exactly mirrored in Stack Cats function exactly as cat programs. Therefore, we can score one program for each valid symmetric character by having there be two of them, and we can score one program for each pair of matching characters. These character sets are: !"*+-:=ITX^_| (){}[]<>\/ Unfortunately, most ...


6

Charcoal, 12 15 programs Edit: Added three more programs which are no-ops only on numeric input. ↧ Try it online! Lowercases the implicit input, which has no effect for numeric input. ↥ Try it online! Uppercases the implicit input, which has no effect for numeric input. θ Try it online! Link is to verbose version of code. Prints the default input. S ...


Top 50 recent answers are included