1
\$\begingroup\$

This question already has an answer here:

A narcissist program is simple. It is related to a quine.

If the input is equal to it's source code, it prints a truthy value, if not it prints a falsy one. That is it.

Rules:

  • It can't read it's own file.
  • This is code-golf, so the shortest answer wins.
  • Hash functions are not allowed. This trivializes it into just string matching.
  • The submission may be a function.

An example would be:

Code:

someprogramhere

Input:

someprogramhere

Output:

1

Or input:

a

Output:

0

Your code most certainly won't be someprogramhere, but you get the idea.

Go code.

\$\endgroup\$

marked as duplicate by a spaghetto, Community Apr 4 '16 at 22:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
\$\begingroup\$

JavaScript ES6, 14 bytes

$=_=>_==`$=`+$

Simple modification of the traditional "bling quine".

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.