yes is 91 lines long

51

11

yes, from coreutils, is 91 lines long. Many of them are comments, but that is still WAY too long.

Edit from September 2019: the source file grew over the past five years and is now 126 lines long.

Write a program that imitates yes:

  • outputting to stdout an infinite stream of "y\n"'s
  • there must be an option to stop it other than killing the process with SIGKILL: but SIGINT and SIGPIPE are fine
  • you are not allowed to use "y" or "\n" or their ASCII values (121, 0x79, 0171, 10, 0xA or 012)

Shortest answer wins.

Bonus:

  • subtract 10 from your code length, if you can receive a phrase in stdin and print it out instead of "y" (but still including the line-break).

Ramon Snir

Posted 2014-12-17T13:32:06.243

Reputation: 659

4For the bonus, should it still print y for empty STDIN? – Martin Ender – 2014-12-17T13:33:45.530

13"you are not allowed to use "y" or "\n"" -- should I read this as "You may not use y or \n inside of a string literal"? – apsillers – 2014-12-17T14:28:45.250

@MartinBüttner Optionally. – Ramon Snir – 2014-12-17T15:37:00.897

@apsillers In the source code, nothing that evaluates to y or \n. Not in a literal, not as a constant, not as a variable name. Nothing. – Ramon Snir – 2014-12-17T15:37:36.797

5@RamonSnir Wait, so I can just print empty lines for empty STDIN if I go for the bonus? – Martin Ender – 2014-12-17T15:38:21.340

2This is impossible in Java, without using System – Ypnypn – 2014-12-17T16:38:13.707

@Ypnypn Here's my best guess: Perhaps a rule of thumb might be "if a source-code token has a y in it, you must be able to replace it with a synonymous token without a y." For example, if you have System.out.print("y"), you can do something like Sstem = System and Sstem.out.print would work fine (at least conceptually). By contrast, if you replace the literal "y" with something else, you're not going to get the same result. I think this should probably clarified in the spec. – apsillers – 2014-12-17T16:46:02.363

13On a related note, GNU true.c is 80 lines long. – Paused until further notice. – 2014-12-17T22:32:11.013

1@Ypnypn It is possible. There are more ways than one to get System.out. – TheNumberOne – 2014-12-18T01:11:08.803

@TheBestOne Indeed; I just solved this with reflection. – Ypnypn – 2014-12-18T01:51:31.693

7@DennisWilliamson On a similarly related note, false.c is 2 lines long.... ;_; – LordAro – 2014-12-18T02:30:44.980

Is providing output in a different character encoding permissible (eg. using PETSCII rather than ASCII-1967)? – Mark – 2014-12-18T06:56:04.290

1@RamonSnir Just to be sure, is my C# answer valid? It uses System (which I cannot get rid of, because it's the top namespace and everything is in it), but in your previous comment you said "nothing that evaluates to y". It does not evaluate to y. Is that answer valid? – ProgramFOX – 2014-12-18T16:40:41.957

@Ypnypn I just solved this without reflection. – TheNumberOne – 2014-12-18T18:13:39.120

6the coreutils yes takes an optional argument on the command line, not stdin. – Brian Minton – 2014-12-18T20:05:08.290

1@RamonSnir and I started this after git cloneing coreutils and getting angry that ls is 8000 lines long. This post is all about getting candidates for replacing the "bloated" coreutils :) – Nitz – 2014-12-18T21:05:19.187

3

@DennisWilliamson: Let me introduce you to GNU Hello

– Nate Eldredge – 2014-12-18T21:46:45.253

@NateEldredge: I call foul though since that's an example program and not a standard utility. ;-) – Paused until further notice. – 2014-12-18T22:00:31.663

2@RamonSnir "Nothing that evaluates to y or \n" would make the challenge impossible. Please clarify what you mean. – nyuszika7h – 2014-12-19T12:28:11.650

I don't get GNU: Why would you possibly need a program which spams you with ys? – MrLore – 2014-12-20T10:30:16.437

7@MrLore: to pipe into other programs that might constantly ask for confirmation of the various things they are doing, so you dont have to sit there typing the ys yourself. – marcus erronius – 2014-12-20T16:57:57.060

1OMG there's no \n at the end of the file O_o that's horrible! – o0'. – 2014-12-21T11:08:59.747

1@mrl i regularly do yes | sudo pacman -Syu because i'm a terrible person – undergroundmonorail – 2014-12-28T18:53:33.617

1@undergroundmonorail the whole story started when I did alias aurauy="yes | ( aura -Suy && aura -Auy )" :) – Ramon Snir – 2014-12-29T08:36:08.937

1There are lots of answers which use 121 + 1 to get y's ascii code. Are those invalid? Can I have newlines outside string literals? – cat – 2016-03-18T18:27:09.893

1Microsoft, 1 Steve Ballmerdevelopers, developers, developers, developers, ... – sergiol – 2017-06-08T00:43:54.630

How do you get to 91 from that page while counting comments? I see 130. – Fabian Röling – 2020-02-16T22:29:07.453

Answers

38

CJam, 13 bytes - 10 = 3

l_'x)?{_oNo}h

You'll need to use the Java interpreter for this, because the online interpreter only returns once the program terminates.

You can abort the program with SIGINT (by pressing Ctrl-C). It will read a line from STDIN, and print that line, or y if the input was empty.

Explanation

l             "Read line from STDIN.";
 _            "Duplicate.";
  'x          "Push character x.";
    )         "Increment to get y.";
     ?        "Ternary operator. Replaces line with y if it was empty.";
      {    }h "Repeat while true. Leaves condition on the stack, which is the output string.";
       _o     "Duplicate line and print.";
         No   "Push string with newline and print.";

After clarification of the OP, the following seems more to spec:

l{_o9c)o1}g

I'll wait with updating the submission until the OP replies to my comment, though.

Martin Ender

Posted 2014-12-17T13:32:06.243

Reputation: 184 808

17I like that your program happens to match /no/i, considering what the challenge it. – Kevin – 2014-12-18T02:27:23.363

22

Brainfuck - 38 bytes

++++++++++[>++++++++++++>+<<-]>+[.>.<]

It doesn't use 10 or 121, because +-<>.,[] are all the meaningful characters in the language anyway, but it does calculate them pretty naively (0+1+1+1+1+1+1+1+1+1+1=10, 10*12+1=121).

This probably depends on the interpreter, but it dies to ^C on my machine.

Brainfuck - (63-10)=53

++++++++++[>,]<<[[<]>>[[.>]<[<]>]]>[>++++++++++++>+<<-]>+[.>.<]

undergroundmonorail

Posted 2014-12-17T13:32:06.243

Reputation: 5 897

@fry I couldn't get it below 39 that way. I need 10 anyway, so I'm either adding 1 to 120 or subtracting 1 from 11, and it's shorter to do the former. – undergroundmonorail – 2014-12-17T14:42:12.857

Yeah, I noticed after that you reused the 10, sorry :P – FryAmTheEggman – 2014-12-17T14:47:56.817

Instead of 1012+1, why not 1111? I think that could save you a char. – ProgramFOX – 2014-12-17T14:52:43.517

@pro I couldn't get it below 39 that way. I need 10 anyway, so I'm either adding 1 to 120 or subtracting 1 from 11, and it's shorter to do the former. – undergroundmonorail – 2014-12-17T14:54:14.627

@undergroundmonorail Ah, I see. – ProgramFOX – 2014-12-17T14:55:48.307

20

Python 3, 27 bytes

Works with at least CPython and Jython.

while 1:print(str(help)[1])

SIGINT stops it.

pgy

Posted 2014-12-17T13:32:06.243

Reputation: 830

19Make it python2 and you can shorten it to while 1:print\help`[1]`. – undergroundmonorail – 2014-12-17T14:04:38.990

4Haha, nice. I completely forgot that there "used to" be a backtick operator in python :) – pgy – 2014-12-17T16:30:36.157

You could use chr(11**2) to save a few characters as well – user1354557 – 2014-12-19T22:33:21.083

2@RamchandraApte You're not allowed to use 121. – Jonathon Reinhart – 2014-12-21T06:24:22.970

19

Pyth, 10 9 6 bytes - 10 = 0 -1 -4

#|zePG

I've been trying for ages to get one that I'm satisified with. Basically converts to:

#      = while True
(implied print)
|      = or
z      = (automatically initialized from stdin)
ePG    = second-to-last lowercase letter = 'y'

swstephe

Posted 2014-12-17T13:32:06.243

Reputation: 649

The "z" variable is initialized from stdin, then the value is simply used after that. Found a short way to get the ascii value without writing it explicitly. – swstephe – 2014-12-18T16:48:24.797

Switched from "^11 2" to "^hT2" to save a character. – swstephe – 2014-12-18T17:13:50.447

Hi swstephe, I'm excited to see another user of the language! A couple of golfs: # has equivalent functionality to W1, and ePG is a much shorter way to get the character y than C^hT2. – isaacg – 2014-12-20T08:03:43.420

Thanks, I'll apply those changes. Still new at this golf thing. I like Pyth, but wish had a few more contextual functions and bit manipulation. – swstephe – 2014-12-21T03:31:18.380

17

Marbelous 14 bytes

0978
]]/\++
!!

This is pretty straightforward, the '/\' device places two copies on its left and right, the right one is incremented by ++ and then falls off the board and is printed. The ]] device pushes any marble to the right if STDIN is empty but lets the first byte on STDIN fall down if it isn't. This will then trigger the !! device, which exits the board. So this will print y\n until you enter anything on stdin.

This only works in the python interpreter.

overactor

Posted 2014-12-17T13:32:06.243

Reputation: 3 500

13

C#, 81 78 76 bytes

Cannot compete with the other languages, but here it is anyway:

class A{static void Main(){for(;;)System.Console.WriteLine((char)('x'+1));}}

Can be killed with SIGINT by pressing Ctrl+C.

No bonus, because it would take more than 10 bytes to get it.

ProgramFOX

Posted 2014-12-17T13:32:06.243

Reputation: 8 017

1Can't you use while(1)? Saves two characters. – Toothbrush – 2014-12-17T15:56:19.220

@toothbrush I have tried that, but that doesn't work in C#. – ProgramFOX – 2014-12-17T15:57:23.800

2for(;;) should work. – core1024 – 2014-12-17T16:07:44.750

How about class A{static void Main(string[]a){for(;;)System.Console.WriteLine(a[0]);}}? It requires input, but it classifies as 63 bytes! – Toothbrush – 2014-12-17T16:08:15.447

@core1024 Thanks, that works! – ProgramFOX – 2014-12-17T16:09:11.120

@toothbrush Good idea, but the question says that input should be given through STDIN, not command line. – ProgramFOX – 2014-12-17T16:09:56.263

@ProgramFOX I didn't realise. – Toothbrush – 2014-12-17T16:17:23.660

How about 'x'+1 instead of 'G'+'2'? Two bytes less. – tomsmeding – 2014-12-18T07:15:01.987

@tomsmeding That works, thanks! – ProgramFOX – 2014-12-18T07:18:47.300

2For some reason, this code still has a y in it. Please examine System. – TheNumberOne – 2014-12-18T16:04:50.620

4@TheBestOne That System cannot be removed. it is the top namespace in the .NET Framework, all classes/other namespaces are in it, so reflection won't help here. But not sure if it's invalid. See Ramon's comment: "nothing that evaluates to y or \n". This does not evaluate to y. I'm leaving a comment on the question to ask Ramon whether this is valid. – ProgramFOX – 2014-12-18T16:39:49.100

11

Java, 178

class C{public static void main(String[]a)throws Exception{for(char c='x'+1;;)((java.io.PrintStream)Class.forName("java.lang.S"+c+"stem").getField("out").get(null)).println(c);}}

Printing requires System, but the y character is forbidden. Hence, I had to use reflection.

Ypnypn

Posted 2014-12-17T13:32:06.243

Reputation: 10 485

FileDescriptor.out is what I meant. – TheNumberOne – 2014-12-18T04:30:56.970

You can save a ; by putting char c='x'+1; into the for loop declaration, so for(char c='x'+1;;) since you have an empty semicolon in there anyway – corsiKa – 2014-12-18T22:58:35.340

@corsiKa Good point. – Ypnypn – 2014-12-19T03:51:23.410

10

Perl: 18 bytes - 10 = 8

The string is from STDIN.

$_=<>;{print;redo}

core1024

Posted 2014-12-17T13:32:06.243

Reputation: 1 811

3Does it print y\n repeatedly if it doesn't receive input from STDIN? If not, then it doesn't properly imitate yes. – vurp0 – 2014-12-17T22:19:37.783

@vurp0 yes does not take input from STDIN after all :) – core1024 – 2014-12-18T23:55:24.637

1It doesn't, but the code golf question here specified that if it doesn't receive input, it should repeatedly print y\n. – vurp0 – 2014-12-19T00:00:11.083

2@vurp0 Where? Any program that reads from a stream will hang without input. – core1024 – 2014-12-19T00:02:48.587

@vurp0 See the OP's comment on the question. – nyuszika7h – 2014-12-19T12:32:55.820

9

Ruby, 30 23 18 bytes

loop{puts ?x.succ}

Can be killed with SIGINT by pressing Ctrl+C.

Thanks to manatwork for sharing improvements!

ProgramFOX

Posted 2014-12-17T13:32:06.243

Reputation: 8 017

1loop{puts [*?x..?z][1]} – 23 chars, loop{puts ?x.succ} – 18 chars – manatwork – 2014-12-17T14:39:53.950

@manatwork Thanks! Updated. – ProgramFOX – 2014-12-17T14:41:10.930

8

Perl, 26 bytes

{print chr$=*2+1,$/;redo}

Custom input from argument (like yes actually works), 22 bytes-10=12

{print @ARGV,$/;redo}

Custom input from stdin, 22 bytes-10=12

while(<>){print;redo}

Nitz

Posted 2014-12-17T13:32:06.243

Reputation: 187

@mar Nitz's program is only 14 bytes long and there's a very highly upvoted comment on your link that says it's chill for filenames to matter if you include them in the bytecount. This seems legit to me. – undergroundmonorail – 2014-12-17T14:00:47.777

oh wait, i didn't see the "you can't use "y"" part of the question. nevermind this is bad – undergroundmonorail – 2014-12-17T14:01:30.383

Right you are. Fixed it – Nitz – 2014-12-17T14:23:22.497

7

C, 64 55 53 45 40 - 10 = 30

main(int c,int**a){for(;;)puts(a[c>1]);}

I'm not hugely happy with this, as it requires the program to be named "y", and to be called with `y` only, so it has to be in $PATH, but hey, first codegolf :)

Alternative:

C, 30 (+ 1 filename)

main(){for(;;)puts(__FILE__);}

Using the same technique as my esteemed colleague @Matt Windsor

  • EDIT: turns out getting round the no \n character made it shorter
  • EDIT2: "int" is shorter than "char"
  • EDIT3: didn't need that variable at all
  • EDIT4: a bit of slightly undefined behaviour never hurt anyone
  • EDIT5: add alternative version

LordAro

Posted 2014-12-17T13:32:06.243

Reputation: 212

6

Linux Bash - 19 bytes

This is probably cheating and subject to failure if you don't have /usr/bin/yes or have a /usr/bin/xes or /usr/bin/zes:

/usr/bin/[x-z]es $*

I think it meets the requirements, though maybe it's violating the "nothing that evaluates to y" rule. And perhaps imitating yes by actually running yes is against the rules.

This could be optimized a bit (though less likely to work) to take it down to 11 bytes:

/*/*/?es $*

I couldn't figure out how to get the 10 point bonus by reading a string from stdin without adding more than 10 bytes to the code

Johnny

Posted 2014-12-17T13:32:06.243

Reputation: 161

2/*/*/?es `line`, or /*/*/?es `head -n1` if you don't have /usr/bin/line. – jimmy23013 – 2014-12-18T16:14:23.623

2Or sed q for line. – jimmy23013 – 2014-12-18T16:15:50.483

5

Common Lisp : (30-10) = 20

(format t"~@{~a~%~:*~}"(read))
  • (read) from input stream
  • print to output stream: (format t ... )
  • iterate over all format arguments (only one here) : ~@{ ... ~}
  • inside the loop, for each argument:

    • print argument ~A followed by a newline ~%
    • rewind current element to the previous one ~:* (infinite loop)

You can break the loop with Ctrl+C, which signals an error with restart options (continue/abort).

coredump

Posted 2014-12-17T13:32:06.243

Reputation: 6 292

5

Linux Bash, 33-10 = 23

read a; while :; do echo $a; done

Can be killed with SIGINT by pressing Ctrl+C.

Orace

Posted 2014-12-17T13:32:06.243

Reputation: 151

You should read only one line and print the same line repeatedly. Your programs are not yes but cat programs. – jimmy23013 – 2014-12-17T17:35:47.900

My bad, I should not have tried it after à day of work. – Orace – 2014-12-17T17:43:18.857

How about read a;for((;;));{ echo $a;} – core1024 – 2014-12-19T22:16:49.420

5

Rust, 52 chars

fn main(){loop{println!("{}",'Y'.to_lowercase())}}

There just isn't seemingly a nice way of computing y without being cheeky in Rust-- they've made too good a job of doing chars safely. I:

  • Can't supply a non-literal string to println!, so no tricks allowed there;
  • Can't add 1 to 'x', because in Rust chars aren't numbers;
  • Can't ROT13 (why doesn't Rust have ROT13 in its standard library!?);
  • Can't easily do anything unsafe like dropping to C strings, converting from numbers to chars, etc without being incredibly verbose and going over 52c.

Nor is going for the code bonus worth it, because reading from stdin would require error handling =3

Much of the code reductions I could find involved doing increasingly rule-flouting things with the compiler environment:

Rust, 44 chars (+ at least 1 char for filename)

fn main(){loop{println!("{:.1}", file!())}}

Obsoleted by below. This one probably doesn't count, as the name of the source file needs to begin with y.

Edit: Rust, 36 chars (35 source, 1 filename)

fn main(){loop{println!(file!())}}

As above, but the file has to be called y (not y.rs, y). Humorously, Rust will overwrite the source with the binary! At least on my machine, the binary does work after that though.

Rust, 37 chars (+ equivalent of env K='y' on your platform)

fn main(){loop{println!(env!("K"))}}

This one is even worse: you need to set the environment variable K to y at compile time.

Edit: if you set K to y\n, you could drop the ln in println!, for a grand total of 35 chars and several facepalms:

fn main(){loop{print!(env!("K"))}}

Matt Windsor

Posted 2014-12-17T13:32:06.243

Reputation: 59

Our usual policy for requiring certain file names or compiler flags is to simply include those in the byte count. – Martin Ender – 2014-12-18T00:58:32.620

@MartinBüttner Fair enough. Oddly enough, it would seem that rust isn't the best language for code golf >:P – Matt Windsor – 2014-12-18T01:00:25.890

You can add one to x in a fashion, but it's still not short: (b'x' + 1) as char – Shepmaster – 2014-12-20T16:13:23.847

5

dc, 12

[30986Pdx]dx

Only outputs y\n. Doesn't read from stdin, so no bonus.

30986 is 0x790A (i.e. "y\n"). The P command simply converts the number to base 256, and prints the corresponding character for each base 256 digit.

Digital Trauma

Posted 2014-12-17T13:32:06.243

Reputation: 64 644

That's pretty clever, how does 30986 evaluate to y\n? – nyuszika7h – 2014-12-19T12:37:22.970

I knew about P but didn't know it can do more than one character at a time. – nyuszika7h – 2014-12-23T13:52:56.633

4

Commodore 64 Basic: 14 13 bytes

1?C|(11↑2):R╭

As usual, I've made substitutions for characters in PETSCII that are not present in Unicode. | is used to represent SHIFT+H, while represents SHIFT+U. Note that this outputs ASCII 'y' (byte value 121) rather than a character that the default Commodore character set displays as 'y'.

BASIC is supposedly an easy-to-learn, English-like programming language. Throw in the typing shortcuts present in many early dialects, and you get something that is shorter and less readable than Perl.

EDIT: In "shifted mode", this gets two bytes shorter, thanks to lowercase "y" being encoded at decimal value 89. Using a non-ASCII character set to get around the "not allowed to use their ASCII values" rule might be cheating, though.

1?cH(89):rU

Mark

Posted 2014-12-17T13:32:06.243

Reputation: 2 099

With all the that exists in unicode, it seems surprising that the full character set used by the C64 wouldn't be in there somewhere. – kasperd – 2014-12-19T09:12:38.007

@kasperd, Unicode's box-drawing characters come mostly from the IBM "DOS" set, and pass through the center of the character cell. PETSCII has a much larger set, much of which uses the edges of the character cell. U+2502 is probably a decent approximation of the vertical bar produced by SHIFT+H, but the pipe character is easier to type. There's nothing corresponding to the "lines on the top and left edges" produced by `SHIFT+O". – Mark – 2014-12-19T10:58:06.607

Very good, but you could save one byte by replacing "Goto 1" by "Run" : "1?cH(89):rU" – LeFauve – 2014-12-20T12:07:42.810

@LeFauve, Thanks. I've also applied it to the ASCII-emitting version. – Mark – 2014-12-20T12:29:01.513

3

AWK, 38 bytes

BEGIN{for(;;)printf("%c%c",60+61,5+5)}

Variant which will read the string on stdin: 14 bytes-10 = 4

{for(;;)print}

But since it cannot do both (revert to "y" if no stdin is provided), I'm not sure it counts... :o)

Both can be exited with Ctrl+C.

LeFauve

Posted 2014-12-17T13:32:06.243

Reputation: 402

3

Ruby, 27 bytes - 10 = 17

It's just @ProgramFOX's solution with the bonus (it took my 9 bytes to solve the bonus question).

loop{puts ARGV[0]||?x.succ}

alexanderbird

Posted 2014-12-17T13:32:06.243

Reputation: 251

3

Haskell, 29 bytes

main=putStrLn[succ 'x']>>main

I believe this is stopped by both SIGINT and SIGPIPE.

Taneb

Posted 2014-12-17T13:32:06.243

Reputation: 31

suggestion: use '\89' instead of succ 'x' – proud haskeller – 2014-12-21T23:55:01.907

3

dc, 21 bytes - 10 = 11

C1st?st[ltP[]ps0dx]dx

Note that the input needs to be wrapped in [], e.g. [no], because ? is the only way to take input, which executes it as dc code.

nyuszika7h

Posted 2014-12-17T13:32:06.243

Reputation: 1 624

You can use C2 instead of 122. In fact I would argue that 122 1- could be replaced with C1 as C1 is not explicitly banned in the question – Digital Trauma – 2014-12-19T16:16:10.840

3

C, 32 bytes

Requires little endian machine and compilation with -O2 (to avoid stack overflow).

a=11*11;main(){main(puts(&a));}

nutki

Posted 2014-12-17T13:32:06.243

Reputation: 3 634

3

Fission, 5 bytes

Rx+!N

This is fairly competitive for Fission. :)

Control flow starts with a (1,0) right-going atom at R. x sets the mass to 120, and + increments it to give (121,0). Then ! prints the corresponding character (y) and N prints a newline. The source code wraps around at the edges, so the atom passes R again (which doesn't do anything now), x sets the mass to 120 again, + increments it and so on and so on...

Martin Ender

Posted 2014-12-17T13:32:06.243

Reputation: 184 808

2

APL (Dyalog APL), 5 - 10 = -5 bytes

Warning: relies on an undocumented and unsupported feature/bug.

⎕←⍣≢⍞

Empty STDIN prints empty lines (not "y"), which is allowed and has been suggested.

Try it online!

 STDOUT with trailing newlines,

 gets

 repeatedly until

 it differs from

 STDIN

i.e. never, but uninterruptible by pausing the thread.

Adám

Posted 2014-12-17T13:32:06.243

Reputation: 37 779

Hmm. abusing bugs.. interesting. – Matthew Roh – 2017-03-01T15:15:01.740

@MatthewRoh Using, not abusing. The "feature" is using the operator on assignment , even though isn't a real function proper, and thus not really eligible to be an operand. Still works through... – Adám – 2017-03-01T16:15:51.950

2

><>, 6 bytes

b:*oao

By not including a ; at the end, the ><> will keep on swimming until he's released by a SIGINT.

Explanation

b:*oao
b         Push 11
 :        Duplicate
  *       Multiply top elements to get 121
   o      Print as character
    a     Push 10
     o    Print as character (yielding '\n')
          No program terminator, so our ><> will 
          keep on swimming this path forever.
^----' 


><>, 17 - 10 = 7 bytes

The previous is quite a boring solution, so here's one that takes input from stdin. This abuses the fact that the default way of supplying input to a ><> program is echo 'input' | fish.py yes.fish, where echo provides the \n character.

 i:0)?!v
0r}o:r~<

Explanation

 i:0)?!v     Load STDIN into the stack (reversed)

             NOP           <----------,
 i           Push a byte from STDIN   |
  :          Duplicate top element    |
   0         Push 0                   |
    )?       If (i > 0):              |
      !        Wrap around  ----------'
             Else:
       v       Move to the second part

0r}o:r~<     Print STDIN until halted

       <     Go right         <---------------,
      ~      Remove top element (duplicated   |
                -1 from EOF)                  |
     r       Reverse stack                    |
    :        Duplicate top element            |
   o         Output as character              |
  }          Rotate stack to right (go to     |
                next character)               |
 r           Reverse the stack                |
0            Push 0                           |
             Wrap around       ---------------'

The 0r at the end allow sfor the loop to happen by wrapping around, where we still assume the stack to be reversed with a -1 on top.

PidgeyUsedGust

Posted 2014-12-17T13:32:06.243

Reputation: 631

2

PowerShell, 27 − 10 = 17

param($s=$Host[1])for(){$s}

Might not work in Pash. A more robust alternative should be

param($s="$(gal gh*)"[2])for(){$s}

Joey

Posted 2014-12-17T13:32:06.243

Reputation: 12 260

2

Lua, 42 bytes - 10 = 32

while 1 do print(...or('').char(90+31))end

Lua, 49 bytes - 10 = 39

y=...or(string.char(60+61))while 1 do print(y)end

Both were tested with Lua 5.1.4 and can be killed with SIGINT (Ctrl+C).

Digpoe

Posted 2014-12-17T13:32:06.243

Reputation: 29

Awesome! My mom writes in Lua, I've never seen it in the wild before. (Hey mom! Guess what I saw!) – Signal15 – 2014-12-19T20:26:08.783

2

Perl, 31

Here is a Perl version that actually behaves like GNU yes, as far as I can tell:

{print "@ARGV"||chr 11**2;redo}

This works if it is okay to use perl's command line switches (-l for the newline), otherwise it would become 3 characters longer:

{print "@ARGV"||chr 11**2,$/;redo}

xebtl

Posted 2014-12-17T13:32:06.243

Reputation: 941

typo: is -l (not -e) the switch for the new line. – chris-l – 2014-12-21T23:10:36.187

Also, the bonus is only if your script can read from the stdin. Yeah, I know that real yes does not read from the stdin, but from an argument, but that is the rule of the OP put; it has to be from stdin to have the bonus. – chris-l – 2014-12-21T23:12:29.447

@chris-l fixed the type, thanks. I also removed the claim regarding the bonus, but I will leave my answer as it is :-P – xebtl – 2014-12-22T09:09:54.667

hehe sure, my own answer is like yours; it uses an argument instead of stdin. IMHO, the op should give the bonus to the ones who actually do what the real yes does. – chris-l – 2014-12-22T20:31:53.973

2

CAPL1.5+ ; 6 without input; 10 - 10 = 0 with input

Sidenote
I have read somewhere [link?] that custom languages aren't allowed in golfing questions, as they could make built-in functions that do exactly what the question is asking, however I made CAPL to make golfing easier in general. If you think this is not allowed here, let me know!

I got some ideas from ><> and Befunge (You can move between lines and use hexadecimal characters to push numbers), some from Ruby and some from my own to make golfing easier.
CAPL reads from left to right, and goes one line down at the end of the line. If it is as the last line, the program will quit.

As no-one knows this language yet, I'll try to explain as much as possible.

Outputting y. 6 bytes

bb*.n<

bb* b is hexadecimal for 11, so bb* is 11*11=121, which is the UTF-8 equivalent of y. This value is pushed to the stack.
. Pops the top value from the stack, and outputs as UTF-8. As 121 is on top of the stack, the index is ignored here.
n Outputs a newline
< Sends the pointer back to the beginning of the line, thus repeating that line. As we don't expect input, we can do this safely without re-asking for the input.

Outputting from input. 10 bytes, 0 after bonus

i~a&{X:.)}

i Takes input from the user, pushes as UTF-8 on the top of the stack, and pushes the length after that. I.e. [72,101,108,108,111,5]
~ Pops a number from the stack, then reverses that amount of bytes. I.e. [111,108,108,101,72]
a Hexadecimal for 10, the newline character
&{...} Makes an infinite loop. We have input, so we can't send the pointer back to the line. I could place the function on the line below, which would safe me a byte, but newlines aren't allowed in this challenge.
X Removes the top value from the stack (The index from the loop)
:. Duplicates the top value, then outputs as UTF-8
) Turns stack right. ([1,2,3,4,5] -> [5,1,2,3,4])

Howver, this means we start with a newline, then start outputting the input, then a newline, then the input, etc. If we're not allowed to start with a newline, use the following code with 12 bytes, or 2 after subtracting the bonus.

iXa#~&{X:.)}

The only new command here is #, which pushes the amount of items on the stack to the stack.
I removed the length from i, because adding 1, then swapping with the newline is longer than removing and getting the length again.

Just for fun, here is a "Hello World" program

"Hello World"#~
#?!;.<

The ?! operation is the same as ><>'s

Charlie

Posted 2014-12-17T13:32:06.243

Reputation: 691

Actually the restriction applies to custom languages/libraries/features published after the question was posted. – manatwork – 2015-08-04T18:28:16.390

@manatwork That would mean my answer is invalid. Thanks for the clarification. I made this language, and wanted to do some golfing challenges to test what I could improve for future versions, if that makes anything better. – Charlie – 2015-08-04T19:28:14.803

In my opinion this is not invalid, just not eligible to win. The restriction's goal was to prevent cheating, but as you included the statement about the language's freshness, this could hardly be considered a cheating attempt. – manatwork – 2015-08-05T06:26:32.743

1

QC 26 (26 - 10 = 16) bytes

(00600F014"0178)0101A01$14

The program requires an input on stdin because QC doesn't have a way to get arguments. Empty input just prints y.

Explanation

(00 read string into memory at address 00, address 00 is length, next bytes are the string itself
600F014 jump if values at 00 and F0, if not equal jump to address 14
"0178 Write 78(lowercase x) to address 01
)0101 increment value at address 01 by 01 which gives y
A01 print string and newline from address 01 until 00 is reached
$14 jump to address 14(print the next line)

cookie

Posted 2014-12-17T13:32:06.243

Reputation: 271

Wait, It's decremented by 10, so it becomes 16 bytes, making this the ultimate answer! – Matthew Roh – 2017-02-12T06:58:40.887

1

Vitsy, 15 - 10 = 5 bytes

Because Vitsy waits for STDIN to be entered, I have made the bonus input come in as command line arguments.

zl)[bD*][:ZaOu]

Explanation:

z               Grab the entirety of the input stack and patch it on the current.
 l)[   ]        If the stack has no members...
    bD*         Push 11^2 to the stack (this is the ASCII value for 'y').
        [     ] Loop infinitely.
         :      Duplicate the current stack.
          Z     Push the entire contents of the stack to output, top first.
           aO   Push out a newline to the out.
             u  Flatten the top two stacks.

Addison Crump

Posted 2014-12-17T13:32:06.243

Reputation: 10 763

1

C(GCC) - 161 bytes

main(int argc,char**argv){if(argc>1){while(1){for(int i=0;i<argc-1;i++){printf("%s ",argv[i+1]);}puts("");}}else{char*c=malloc(1);c[0]='x'+1;while(1){puts(c);}}}

Uses malloc to allocate 1 byte and set its value 'x' + 1 If any input is provided as an argument(mulitple words work too) it will print it instead of y.

Ungolfed version:

main (int argc, char**argv) {
    if (argc > 1) {
        while (1) {
            for (int i=0; i < argc - 1; i++) {
                printf("%s ",argv[i+1]);
            }
            puts("");
        }
    } else {
        char* c = malloc(1);
        c[0] = 'x' + 1;
        while(1) {
            puts(c);
        }
    }
}

cookie

Posted 2014-12-17T13:32:06.243

Reputation: 271

1

Ohm, 17 - 10 = 7 bytes

IDö?.x1+;Ω
D,∞

Explanation:

IDö?.x1+;Ω  ■Main link
I           ■Input
 Dö?    ;   ■If(!input){
    .x1+    ■  Push 'x' and increment
            ■}
         Ω  ■Call link below

D,∞         ■Helper link
  ∞         ■while (true){
D,          ■  duplicate and print
            ■}

Roman Gräf

Posted 2014-12-17T13:32:06.243

Reputation: 2 915

1

Perl 5 - (10-10) = 0 bytes

print;redo

Requires the -ne flags. Takes in a character(s) from STDIN, repeats the character(s) infinitely.

Example execution

perl -ne 'print;redo'

Explanation

This takes advantage of the -n flag in Perl, where it explicitly wraps while (<>) { ... } around the source code. The use of redo without an explicit label is also used. According to the documentation: If the LABEL is omitted, the command refers to the innermost enclosing loop.

booshlinux

Posted 2014-12-17T13:32:06.243

Reputation: 81

1

Apparently this isn't totally portable. My sys.version is 2.7.9 (default, Dec 11 2014, 04:42:00) \n[GCC 4.9.2], so if yours is different this might not work I guess.

Python 2 - (76-10)=66

import sys
s=sys.stdin;a=`help`[1]if s.isatty()else s.read()
while 1:print a

Pretty long, but I wanted to go for the bonus (even though it cost more than 10 bytes). Checking if stdin is empty or not without prompting for input is long, apparently.

At first, I misread the bonus as taking an argument instead of stdin. I'm proud of my solution for that, so I'm posting it anyway ;)

Python 2 - (52-10+∞)=∞ (invalid!)

import sys
while 1:print(sys.argv+[0])[1]or`help`[1]

sys.argv is a list where the zeroth element is the filename and every element afterwords is an argument given to the program. I add a falsey value to the end of the list; if there are no arguments, the first element is that falsey value, otherwise it's the first argument. a or b in Python returns the first value that confirms what the outcome will be: If a is truthy, we already know that the whole thing will be true, so it just gets returned. If it's false, b is returned (since False or b == b).

undergroundmonorail

Posted 2014-12-17T13:32:06.243

Reputation: 5 897

@fry I could, but it would prompt the user. I wanted it to start spitting out y\n immediately if stdin was empty. – undergroundmonorail – 2014-12-17T14:53:45.750

@fry That's weird, it works for me. It might be dependant on cPython? I don't have any other ideas. – undergroundmonorail – 2014-12-17T15:10:02.880

good idea, on it – undergroundmonorail – 2014-12-17T15:17:06.897

r=raw_input();p=r if r else\help`[1]\nwhile 1:print p`

52 characters – globby – 2014-12-18T06:07:27.810

1Hmm, already the first line seems to have an y in it, the second one too. – Paŭlo Ebermann – 2014-12-18T12:51:41.030

1

Windows Batch: 24 bytes

A yes.bat file with this content will work on most Windows XP and later systems with default settings:

@echo %COMSPEC:~12,1%&%0

Else this slightly larger yes.bat file (34 bytes) will work in all cases:

@set "T=%~n0"
@echo %T:~0,1%
@%0

Can be made down to 13 bytes if the file is called y.bat instead of yes.bat, but I feel that's cheating:

@echo %~n0&%0

Jean-François Larvoire

Posted 2014-12-17T13:32:06.243

Reputation: 119

1

linux (Ba)sh, 13 to 26 (23 to 36 chars) (repeats 'y' or the input, like yes)

create an executable (+x) file, named as you like (ex: my_yes), containing one of those possible contents:

echo ${*:-y};exec $0 $*  #23 chars, score 13, but loses spaces, and will choke on many inputs

or

echo "${@:-y}";exec $0 "$@"  #27 chars, score 17, but will choke on some inputs

or

printf "%s\n" "${@:-y}";exec $0 "$@"  #36 chars, score 26, a tiny more robust, but "longer"

and then execute it with the arguments you want, it will repeat them ad-lib. (With no arguments, it repeats "y", as the yes command does too)

$ chmod +x my_yes
$ ./my_yes
y
y
y
[ctrl-C]

$ ./my_yes '  It looks ok!'
  It looks ok!
  It looks ok!
  It looks ok!
  It looks ok!
[ctrl-C]

Olivier Dulac

Posted 2014-12-17T13:32:06.243

Reputation: 209

some inputs that can make it choke on the first 2 : first argument starting with a "-", for example. (and many others) – Olivier Dulac – 2014-12-18T13:18:58.027

I use "exec" to ensure I don't bring the computer down very quickly with recursive bash (which 'yes' doesn't do, usually ^^) – Olivier Dulac – 2014-12-18T13:20:23.810

1

C89, 31 37 chars

main(){for(;;)printf("%c\n",'z'-1);}

Built on the idea of @LordAro, without filename requirements.

rubenvb

Posted 2014-12-17T13:32:06.243

Reputation: 224

1

Fortran, 28

do1;1 print'(A1)',11**2;end

Compile with gfortran -ffree-form.

xebtl

Posted 2014-12-17T13:32:06.243

Reputation: 941

1

CFML, 247 bytes

This is more a "just for the heck of it" answer, as it's obviously hideously long (CFML earns no points for terseness); and I just realized it can't actually be killed without restarting the service, although it will indeed stop printing to the browser on an ESC character.

<html><body><cfflush><cfif isDefined("URL.i")><cfscript>a=URL.i;if(a is ""){a=chr(asc("x")+1);}while(1){writeOutput("#a#<br>");getPageContext().getOut().flush();}</cfscript><cfelse><form action="a.cfm"><input name="i"/></form></cfif></body></html>

Matt Gutting

Posted 2014-12-17T13:32:06.243

Reputation: 121

1

C, 35 bytes

main(a,b){b='x'+1;for(;;)puts(&b);}

I don't know if this will compile correctly with all compilers on all platforms or not; if it doesn't work for you, let me know. I used several things here that I have never thought of using before. :)

BenjiWiebe

Posted 2014-12-17T13:32:06.243

Reputation: 231

1

Node.js, 53 chars (63 if you count node -e "")

update:

  • Reduced another 5 chars.
  • Silly extra char removed.
  • Reduced 2 chars, from 61 to 59.

The real yes does not uses stdin, but an argument, like:

yes n

Well, this answer works like that, it will print y\n over and over:

node -e "for(;;)console.log(process.argv[1]||34 .toString(36))"

And if you append an n after the line, it will print n\n instead:

node -e "for(;;)console.log(process.argv[1]||34 .toString(36))" n

No bonus, since I'm not using stdin.

chris-l

Posted 2014-12-17T13:32:06.243

Reputation: 111

0

SmileBASIC, 19 bytes - 10 = 9

INPUT C$@L?C$GOTO@L

12Me21

Posted 2014-12-17T13:32:06.243

Reputation: 6 110

0

PHP, 34 bytes - 10 = 24

for(;;)echo$argc>1?$argv[1]:y,"
";

Run with php -nr '<code>' or php -nr '<code>' '<string>'.

Or 56 bytes for an exact port:

for(;;)echo$argc>1?join(" ",array_slice($argv,1)):y,"
";

(-2 bytes with extended ASCII; -1 for the not-so-complete version)

Titus

Posted 2014-12-17T13:32:06.243

Reputation: 13 814

0

Jelly, 7 - 10 = -3 bytes

ØyṪ³ȯṄß

Try it online!

Explanation

Øy             # The string "AEIOUYaeiouy"
  Ṫ            # Take the last element, namely "y"
    ³          # The cmdline argument (empty list if none supplied)
     ȯ         # Either the cmdline if supplied or "y"
      Ṅ        # Print with a newline
       ß       # Recurse

Thankfully Jelly programs can always be C-c-ed.

Alternative Sans Y; 10 - 10 = 0 bytes

“¢³ƒ»Ṫ³ȯṄß

If the 'y' in the original answer is unacceptable, here's one without. This works on the same principle, the string “¢³ƒ» is the compressed version of "Jelly"

walpen

Posted 2014-12-17T13:32:06.243

Reputation: 3 237

0

R, 51 bytes

while(T){cat(paste0(letters[25],'\\',letters[14]))}

Literally outputs "an infinite stream of "y\n"'s", rather than "y[newline]".

In RStudio the output is truncated but it is otherwise infinite.

BLT

Posted 2014-12-17T13:32:06.243

Reputation: 931

0

Python 3, 40 bytes - 10 = 30

i=input()
while 1:print(i or chr(11**2))

Stops with SIGINT (Ctrl+C)

sagiksp

Posted 2014-12-17T13:32:06.243

Reputation: 1 249

0

R, 27-10 = 17 bytes

x=scan(,'');repeat print(x)

Repeats stdin over and over and over. No y or \n in the code.

rturnbull

Posted 2014-12-17T13:32:06.243

Reputation: 3 689

0

OIL, 23 bytes noncompeting

120
8

17

1

4

11
6
6

Increments 120, transforms it to a "y", and repeatedly print it and a newline.

Can be stopped with SIGINT / Ctrl+C.

Variant that receives something from stdin instead:

OIL, 13-10 = 3 bytes

5

4

11
6
2

L3viathan

Posted 2014-12-17T13:32:06.243

Reputation: 3 151

0

AHK, 38 bytes - 10 = 28

c=%1%
Loop,3
FileAppend,% c Chr(9+1),*
  • I may have misunderstood, but I think the 9+1 is allowed. If not, I'll delete this.
  • If Loop is used without brackets {}, it is assumed that only the next line is part of the loop.
  • If Loop is used without a count, it will repeat until it encounters a Break.
  • Per the help file, if an asterisk is passed as the filename into FileAppend, it outputs to stdout.
  • %1% is the first passed argument.
  • If I could use the input variable %1% directly, that would have been nice. It gets funny with the Chr function following it, though, and would have ended up being more bites.

Engineer Toast

Posted 2014-12-17T13:32:06.243

Reputation: 5 769

0

TI-BASIC, 8 bytes

While not(getKey:Disp Str0:End

Hactar

Posted 2014-12-17T13:32:06.243

Reputation: 646

0

Chip, 15+3 = 18 bytes

+3 for flag -w, which ignores stdin and generates an endless stream of null bytes for input instead.

dbae
*}++g
 `zf

Try it online!
Note about the TIO: instead of using the -w flag, it uses input. The behavior is the same, except that input is finite. One byte of output per byte of input.

Explanation

*}+
 `z

This is a 1-clock. On the first byte, the + is active, and on the second byte, the other three elements are active. The two states alternate endlessly.

d ae
* ++g
   f

This produces the output corresponding to 'y'. These letters each map to a bit: _gfed__a -> 0b01111001 -> 0x79 -> 'y'.

db
*}
 `z

This produces the output corresponding to '\n'. Similar to above, but we have these bits: ____d_b_ -> 0b00001010 -> 0x0a -> '\n'.

Phlarx

Posted 2014-12-17T13:32:06.243

Reputation: 1 366

0

Tcl, 39 bytes

while 1 {puts [format %c [expr 11*11]]}

Try it online!

sergiol

Posted 2014-12-17T13:32:06.243

Reputation: 3 055

0

><>, 5 bytes - 10 = -5

a{:o!

Try it online!

Takes input via the -s flag and repeats it forever until the program is interrupted.

Jo King

Posted 2014-12-17T13:32:06.243

Reputation: 38 234

To qualify for the bonus, I think this should print y if no input is given. – user41805 – 2018-04-15T12:42:10.023

@Cowsquack Nope, it's optional

– Jo King – 2018-04-15T13:13:33.430

0

MathGolf, 8 bytes -10 = -2

╜É'x)Äo∟

Try it online!

Explanation

╜É         else without if (executes block of 3 chars if input is empty)
  'x)      increment "x" to get "y"
     Ä     start block of length 1
      o    print TOS without popping
       ∟   do while true without popping

Quite straightforward, but gets the job done.

maxb

Posted 2014-12-17T13:32:06.243

Reputation: 5 754

You don't need to print y if there's no input – Jo King – 2019-09-20T22:12:04.100

maxb bug report for MathGolf: string input which contains spaces are automatically transformed to lists (even if they are already inside lists). I noticed this, because it screwed up the length builtins £ and h: Try it online. – Kevin Cruijssen – 2019-10-08T12:10:47.313

@KevinCruijssen I think I overcomplicated the implementation of implicit input, which causes these errors. I'll see if I can switch to a pure ast.literal_eval statement for the input, which should solve a lot of issues. – maxb – 2019-10-10T10:35:07.460

0

Python 3, 25 bytes

while 1:print(chr(11*11))

Try it online!

gadzooks02

Posted 2014-12-17T13:32:06.243

Reputation: 527

0

W s, 9-10 = -1 bytes

ib12 1C|E

Explanation

Flag: s % We have to read from STDIN :(
i   E   % Foreach from 1 to infinity:
 b      % Take the value of the second operand
        % (the first operand is the infinity-count value)
        % AND print this value with a newline
  12 1| % Just uses a space to do the constant-avoiding job.

W, 7 bytes

i12 1CE

Explanation

i     E % Foreach from 1 to positive infinity:
         % (Implicit print a newline on each iteration)
 12 1    % Space does nothing. Basically just pushes 121.
     C  % Convert to a character, rendering 'y'

user85052

Posted 2014-12-17T13:32:06.243

Reputation:

0

Python 3, 26-10=16 bytes

x=input()
while 1:print(x)

Seems too easy. Never posted here before so probably done something dumb. What did I miss?

UPDATE I don't think this is cheating (35-10=25):

exec("x=input()\nwhile 1:print(x)")

Andrew Parker

Posted 2014-12-17T13:32:06.243

Reputation: 101

Welcome to the site! I think this question doesn't allow newlines so you should use ; instead. The question is a little confusing IMO and I've been here a while. – Post Rock Garf Hunter – 2019-12-23T16:57:54.960

Does it satisfy constraint about closing program? – Qwertiy – 2019-12-23T16:59:39.843

@WheatWizard, python doesn't support semicolons. – Qwertiy – 2019-12-23T17:00:08.247

Oh right. So I'm not even allowed newlines in my source. Got it! :laugh: – Andrew Parker – 2019-12-23T17:08:44.893

Best I can get with the bonus is 27, and I need the walrus to do that: x,*_=iter(lambda:print(z),z:=input()) – Andrew Parker – 2019-12-23T18:10:23.450

Actually, that will probably segfault eventually. A set can be used to keep it going indefinitely I think set(iter(lambda:print(z),z:=input())) – Andrew Parker – 2019-12-23T18:11:17.867

0

Mumps (M), 12 bytes - 10 = 2 bytes

Quite simple in Mumps (M), as the language allows single character commands and a newline is denoted by '!'...

R I F  W I,!

Breakdown:

Read STDIN into I, For (with two spaces) = infinite loop, Write contents of I, then newline (!)

Works on both InterSystems & YottaDB (GT.M).

zmerch

Posted 2014-12-17T13:32:06.243

Reputation: 541

0

JAGL V1.0 20 - 10 = 10 With Bonus, 14 Without

Tdn{78h[}Sf{p9[pDd}u

Coulda probably done better, but here is the explaination:

Td                               Get a line of text input, and duplicate on stack
  n                              Negate its truth value (for the if)
   {78h[}                        Push a block which will push the y character, if called
         Sf                      Swap top two values on stack and if no input, push y
           {p9[pDd}              Push block which prints the input (or y) and a newline
                   u             Do until loop. Output always evaluates to true

Can be killed by SIGINT

Without bonus:

'x  '{1+}/{pd}u

explaination:

'x  '                            Pushes the string '\tx'
      {1+}                       Adds 1 to each character in the string, making it 'y\n'
          {pd}u                  Infinitely prints and duplicates 

globby

Posted 2014-12-17T13:32:06.243

Reputation: 1 132

0

Plan 9 rc: 20-10=10 (but not quite there)

f=`{cat};while()echo $f

The problem with this almost-solution is that it must have something on stdin. I haven't yet been able to find a way to get it to print y if stdin isn't there.

Matt Windsor

Posted 2014-12-17T13:32:06.243

Reputation: 59

0

Java, 157 154 bytes

Despite the common misconception that you have to use System.out to print anything to the console in Java, this program outputs to the console using a FileOutputStream to the file described by FileDescriptor.out. Accoding to the specification for FileDescriptor.out, it is "A handle to the standard output stream. Usually, this file descriptor is not used directly, but rather via the output stream known as System.out".

class A{public static void main(String[]a)throws Exception{for(;;)new java.io.FileOutputStream(java.io.FileDescriptor.out).write(new byte[]{120+1,9+1});}}

TheNumberOne

Posted 2014-12-17T13:32:06.243

Reputation: 10 855

0

Pascal: 40 characters

begin while 1=1do Writeln(Succ('x'))end.

Outputs “y”, stops on SIGINT.

manatwork

Posted 2014-12-17T13:32:06.243

Reputation: 17 865

0

Lazy K, 167 bytes

`k````ssi``s`k``ss`k``siik``s`k`s``si`k```s``s`kski``s``s`ksk``s``s`ksk```s``s`kski``s``s`ksk``s``s`kski``s`kk``s`k`s``si`k``s``s`ksk```s``s`kski``s``s`ksk``s``s`kskik

It is probably too long...

```ssi``s`k``ss`k``siik                                              fixed-point combinator
``s``s`ksk```s``s`kski``s``s`ksk``s``s`kski                          \n
```s``s`kski``s``s`ksk``s``s`ksk```s``s`kski``s``s`ksk``s``s`kski    y

jimmy23013

Posted 2014-12-17T13:32:06.243

Reputation: 34 042

0

C 42

main(){while(1){putchar(11*11);puts("");}}

bacchusbeale

Posted 2014-12-17T13:32:06.243

Reputation: 1 235

0

This works in my Befunge interpreter:

"z"1-.25*.

10 chars. "z" means push the ascii value of the characted "z", 1 means push the number one, - means subtract, . means print the ascii value of it and * means multiply. For more info: http://en.wikipedia.org/wiki/Befunge

Loovjo

Posted 2014-12-17T13:32:06.243

Reputation: 7 357

0

Microscript, 19-10=9

If['w2s]1{CaI#!Zx}h

Besides the initial input, takes an extra input after each iteration and halts when and if any of the additional inputs is non-empty (the specs for the question said to provide a way to make it halt).

SuperJedi224

Posted 2014-12-17T13:32:06.243

Reputation: 11 342