1
\$\begingroup\$

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\$
2
\$\begingroup\$

JavaScript ES6, 14 bytes

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

Simple modification of the traditional "bling quine".

| improve this answer | |
\$\endgroup\$

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