Code Golf
add tag
liek
Since TopAnswers already [has](https://topanswers.xyz/codegolf?q=609) a post stolen from [Martin Ender](https://codegolf.stackexchange.com/questions/55422/hello-world), let's steal another one! Your task is to write a program that copies an input taken from STDIN to STDOUT. [Link](https://codegolf.stackexchange.com/questions/62230/simple-cat-program)

|  Input | Output |
|:------:|:------:|
|`abcdef`|`abcdef`|
Top Answer LaTeX
samcarter
# LaTeX/Ti*k*Z

Program:

```
\documentclass{book}
\usepackage{tikzlings}
\def~#1{\tikz\cat[speech={#1}];}
\begin{document}
~{abcdef}
\end{document}
```

Output:

![document.png](/image?hash=d1c580ba119e193eea38e334c73c6762dd4375ab02e5512771ba806f1faf7a66)

Answer #2
Mathgeek
# Polyglot ([W], [GolfScript], [Flurry]), 0 bytes


```
```

Works in at least W, Golfscript [(GS: TIO)][TIO-k7am8gmc], and Flurry, likely more. These languages push input to the stack and implicitly print the stack at the end. They accept input in any format and get converted to strings for output.

[GolfScript]: http://www.golfscript.com/golfscript/
[TIO-k7am8gmc]: https://tio.run/##S8/PSStOLsosKPkPBCEZmcUKQJSYp5CZV1BaogcA "GolfScript – Try It Online"
[W]: https://github.com/A-ee/w
[Flurry]: https://github.com/Reconcyl/flurry
Answer #3 APL (Dyalog Unicode)
Adám
# [APL (Dyalog Unicode)], 1 [byte](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") ([SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set"))

Full program.

```apl
⍞
```

[Try it online!][TIO-k88n336w]

`⍞` prompts from stdin, with printing to stdout happening implicitly.

[APL (Dyalog Unicode)]: https://www.dyalog.com/
[TIO-k88n336w]: https://tio.run/##SyzI0U2pTMzJT///qKO94P@j3nkgxn8FMCjgSkxKTklNAwA "APL (Dyalog Unicode) – Try It Online"
Answer #4 Ahead
ajc2
# [Ahead], 4 bytes
This program will not write to STDOUT until STDIN is closed or empty.

    SUW@
    
    S slurp stdin to string
    U reverse string
    W write string
    @ end

[Try it online!][TIO-k7mzpytr]

[Ahead]: https://github.com/ajc2/ahead
[TIO-k7mzpytr]: https://tio.run/##S8xITUz5/z84NNzh///UgsxkBTgBAA "Ahead – Try It Online"
Answer #5
wizzwizz4
# [Rust], 75 bytes

    ||{use std::io::*;for x in stdin().bytes(){stdout().write(&[x.unwrap()]);}}

Explanation:

    // closure with no arguments
    || {
        use std::io::*;			// This is shorter than the prelude
        for x in stdin().bytes() {
            stdout().write(
            	&[				// Stdout::write takes an &[u8]
                	x.unwrap()	// x is a Result<u8, std::io::Error>
                ]
            ); 
        }
    }

[Try it online!][TIO-kb7rtjac]

[Rust]: https://www.rust-lang.org/
[TIO-kb7rtjac]: https://tio.run/##FcpBCsMgEEDRfU9hN2GmhBxAL9A7lC4SoiBYp4wjJiSe3Zjlf3zOSZqL6jf7CHhAO88jJ6uSrFp70vplHLHalI@33dO07GJTn3tTlg6FvVgYPtuUY@H5D/hFU2tDwNreNgQaH4U4rM8L "Rust – Try It Online"
Answer #6
xigoi
# [Nim], 26 bytes

    stdout.write stdin.readAll

[Try it online!][TIO-khok7ad4]

[Nim]: http://nim-lang.org/
[TIO-khok7ad4]: https://tio.run/##y8vM/f@/uCQlv7REr7wosyRVAcjJzNMrSk1McczJ@f/fIzUnJ59LQaE8vygnRREA "Nim – Try It Online"
Answer #7
Dion
[MAWP 0.1](https://esolangs.org/wiki/MAWP), 7 bytes
=
```
|0~[;].
```
Explanation:
```
|        push all input characters as ascii values
0        push 0 to stack
~        reverse stack
[        start of loop. If no input, skip loop due to 0
;        print as ascii char
]        loop end. If all ascii values printed, end loop due to 0
.        terminate program
```
Answer #8
AviFS
# [FRACTRAN], 0 bytes

	 

[Try it online!][TIO-kcg70e0i]

Were this just another stack lang, I'd comment on that one. This one works differently however:

1. For the first fraction f in the list for which *n × f* is an integer, replace *n* by *n × f*
2. Repeat this rule until no fraction in the list produces an integer when multiplied by *n*, then halt.

Thus the empty program immediately halts after being unable to find a suitable fraction, and spits back the input. (Only gives/takes numbers as IO.)

Interestingly, there's no other FRACTRAN cat program. It would have to only consist of fractions *1/n* where *n*'s prime factors are all larger than any of the inputs.

Therefore, only if you know the the input will never be greater than *k*, could you generate another (infinite) valid FRACTRAN program, eg. *1/p* where *p > n* & *p* is prime

[FRACTRAN]: https://github.com/DennisMitchell/ffi
[TIO-kcg70e0i]: https://tio.run/##SytKTC4pSsz7DwKWlv/yC0oy8/OK/@vmAQA "FRACTRAN – Try It Online"

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.