Meta Cat Program

From Esolang
Jump to navigation Jump to search

This is my SECOND programming problem I've written. yay. I guess. 5anz (talk)

Given an input, a Meta Cat Program outputs a program that outputs the original input. Both programs (The Meta Cat Program and the output of it) must be in the same language. For example, Python cannot print JavaScript code. I mean, it definitely can, but then it wouldn't be a Meta Cat Program. Well, unless it outputs a Polyglot, but we're getting too technical, and we're missing the point

Below is a diagram (that I made in MS paint) that explains a bit how this works, because I'm not confident in my ability to explain things.

Text --in--> Meta Cat --out--> MC Output --out--> The original text but I can't exactly show that in text though, can I?


This is also kind of a combination of a Cat Program and a print("Hello, World!") program, and unlike those, this can actually be somewhat useful.

Implementations

Add an implementation in you're own language if possible.

1nteger

SET inp
WHILE int > 0
    PNT 1347310624
    PNT int / 100 + 48
    PNT int / 10 % 10 + 48
    PNT int % 10 + 48
    PNT 10
    SET inp
END

Brainfuck

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

Python

#actually programmed this at school.
outOut = input()

print("out = \"\"")
for char in outOut:
    print("out += chr(" + str(ord(char)) + ")")

print("print(out)")

See Also

print("Hello, World!")

Cat program

Quine