Narcissist: Difference between revisions
Content added Content deleted
(→{{header|Go}}: 80 characters / line) |
(Added Perl 6 solution.) |
||
Line 134: | Line 134: | ||
Run: |
Run: |
||
<lang>perl narc.pl < narc.pl</lang> |
<lang>perl narc.pl < narc.pl</lang> |
||
=={{header|Perl 6}}== |
|||
For the narcissist to work you must be very careful with whitespace. The presented version works if it is stored as a file of exactly one line terminated by a (Unix) newline character. |
|||
Note: The code can be simplified as soon as Perl 6 implementations support nested quoting delimiters properly (i.e. q{ ...{...}...}). |
|||
<lang perl6>my $self=q|say slurp() eq ('my $self=q'~124.chr~$self~124.chr~'; eval($self);'~10.chr)|; eval($self); |
|||
</lang> |
|||
{{out}} |
|||
<pre>$ rakudo narcissist.pl <narcissist.pl |
|||
True |
|||
$ rakudo narcissist.pl <any-other-input.txt |
|||
False |
|||
</pre> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |