[Question]
  [
`yes`, from coreutils, is [91 lines long](http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/yes.c?id=8e93dc629727140e950a709008f9a17ca461af63). 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). The program [doesn't have to](https://codegolf.stackexchange.com/questions/42428/yes-is-91-lines-long/162321?noredirect=1#comment100392_42428) print `y` on an empty input.
  
[Answer]
# CJam, 13 bytes - 10 = 3
```
l_'x)?{_oNo}h
```
You'll need to use [the Java interpreter](https://sourceforge.net/projects/cjam/) 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.
[Answer]
# 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
```
++++++++++[>,]<<[[<]>>[[.>]<[<]>]]>[>++++++++++++>+<<-]>+[.>.<]
```
[Answer]
# Python 3, 27 bytes
Works with at least CPython and Jython.
```
while 1:print(str(help)[1])
```
SIGINT stops it.
[Answer]
# 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'
```
[Answer]
# [Marbelous](https://github.com/marbelous-lang) 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.
[Answer]
# 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.
[Answer]
## 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.
[Answer]
# Perl: 18 bytes - 10 = 8
The string is from STDIN.
```
$_=<>;{print;redo}
```
[Answer]
# Ruby, ~~30~~ ~~23~~ 18 bytes
```
loop{puts ?x.succ}
```
Can be killed with SIGINT by pressing `Ctrl`+`C`.
Thanks to [manatwork](https://codegolf.stackexchange.com/users/4198/manatwork) for sharing improvements!
[Answer]
# 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
[Answer]
# 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}
```
[Answer]
## 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
[Answer]
# 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.
[Answer]
## **Linux Bash, 33-10 = 23**
```
read a; while :; do echo $a; done
```
Can be killed with SIGINT by pressing `Ctrl`+`C`.
[Answer]
# 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"))}}
```
[Answer]
## 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).
[Answer]
## 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
```
[Answer]
# [Fission](http://esolangs.org/wiki/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...
[Answer]
# Haskell, 29 bytes
```
main=putStrLn[succ 'x']>>main
```
I believe this is stopped by both `SIGINT` and `SIGPIPE`.
[Answer]
# 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}
```
[Answer]
# 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.
[Answer]
## 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.
[Answer]
## 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}
```
[Answer]
# C, 32 bytes
Requires little endian machine and compilation with -O2 (to avoid stack overflow).
```
a=11*11;main(){main(puts(&a));}
```
[Answer]
### Javascript, 39 37 bytes
```
for(;;)console.log(''+Function()[13])
```
### Shorter alternative that only works in the browser, 36 bytes
```
for(n=''+crypto;;)console.log(n[10])
```
### Alternative without console.log, only works in NodeJS, 58 57 56 bytes
```
for(n=''+Function()};;)process.stdout.write(n[13]+n[19])
```
[Answer]
## 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}
```
[Answer]
# 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`).
[Answer]
## Fortran, 28
```
do1;1 print'(A1)',11**2;end
```
Compile with `gfortran -ffree-form`.
[Answer]
# [APL (Dyalog APL)](https://www.dyalog.com/), 5 - 10 = -5 bytes
Warning: relies on an undocumented and unsupported feature/bug.
```
‚éï‚Üê‚ç£‚â¢‚çû
```
[Empty STDIN](https://codegolf.stackexchange.com/questions/42428/yes-is-91-lines-long?page=2&tab=active#comment100350_42428) prints empty lines (not "y"), which [is allowed](https://codegolf.stackexchange.com/questions/42428/yes-is-91-lines-long?page=2&tab=active#comment100392_42428) and [has been suggested](https://codegolf.stackexchange.com/users/8478/martin-ender).
[Try it online!](https://tio.run/nexus/apl-dyalog#@/@ob@qjtgmPehc/6lz0qHfe//@VAA "APL (Dyalog APL) ‚Äì TIO Nexus")
`‚éï` STDOUT with trailing newlines,
`‚Üê` gets
`‚ç£` repeatedly until
`‚â¢` it differs from
`‚çû` STDIN
i.e. never, but uninterruptible by pausing the thread.
[Answer]
# [Ahead](https://github.com/ajc2/ahead), 8 bytes
```
~W-1z'N~
```
[Try it online!](https://tio.run/##S8xITUz5/78uXNewSt2v7v9/AA "Ahead ‚Äì Try It Online")
]