21
3
You should write a program or function that receives a positive integer N
as input and prints out the first N
characters of your code. If N
is larger than the length of your code you should continue output your code cyclically.
Reading your source code in any way and reading from file, stdio, etc. are disallowed.
Examples
(assuming your code is yourcode
)
Input => Output:
5
=> yourc
10
=> yourcodeyo
22
=> yourcodeyourcodeyour
Clarification
Your program should be at least 1 byte long.
15Congratulations on posting the 2000th code golf challenge! :) – Martin Ender – 2015-01-25T12:55:35.253
3Douglas Hofstadter would love this! – Luis Mendo – 2015-01-25T17:51:28.613
1@MartinBüttner Actually, there are over 300 deleted [code-golf] questions. But close enough ;) – Doorknob – 2015-01-26T02:57:32.940
11@MartinBüttner Thank you. Only 48 to go until a round number! – randomra – 2015-01-26T09:29:18.020
5Maybe it's time you mentioned explicitly that empty programs are invalid? – Martin Ender – 2015-01-26T20:42:24.540
Does using a function that returns the "stringified" or "pretty-printed" version of its argument count as the program reading its own source code? – zgrep – 2018-04-11T05:55:09.270