# Should stdout be ignored when the program is a function?

My understanding is that, when stdout is used for output, stderr is ignored. Similarly, it would seem that, when a function's return value is used for output, stdout and stderr should be ignored. After all, this Racket code prints #<procedure>, and yet no one would complain about it:

(lambda (x) x)


My use case is that, in an answer I'm working on, defining a function prints its name because of the requirements of the problem and a quirk of the language. This is not just about code golf (actually, it's for a cops-and-robbers challenge).

• Related discussion for code golf. meta.codegolf.stackexchange.com/questions/8871/… Mar 16 '17 at 5:52
• @Dennis Hmm, I think that answers my question. I don't see why the same principle shouldn't apply to cops-and-robbers. Mar 16 '17 at 6:04
• If this is for a CnR, then it would be fair to mention any such side-effects in the cop, because otherwise robbers might be searching explicitly for clean solutions if they're not aware that this is legitimate. Mar 16 '17 at 8:53
• It is useful to point out that it is permitted to write a function that does output to stdout. In which case it seems common place to ignore the return of the function all together.
– Wheat Witch Mod
Mar 17 '17 at 4:54