Jump to content

Narcissist: Difference between revisions

Added Perl 6 solution.
(→‎{{header|Go}}: 80 characters / line)
(Added Perl 6 solution.)
Line 134:
Run:
<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}}==
57

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.