Narcissist: Difference between revisions

Content added Content deleted
(Added Mathematica)
Line 227: Line 227:
Note how the code takes advantage of Perl 6's ability to nest quoting delimiters.
Note how the code takes advantage of Perl 6's ability to nest quoting delimiters.


<lang perl6>eval my $self = q{say slurp() eq q[eval my $self = q{]~$self~q[}]~10.chr ?? q{Beautiful!} !! q{Not my type.}}</lang>
<lang perl6>EVAL my $self = q{say slurp() eq q[EVAL my $self = q{]~$self~q[}]~10.chr ?? q{Beautiful!} !! q{Not my type.}}</lang>


{{out}}
{{out}}
<pre>$ narcissist='eval my $self = q{say slurp() eq q[eval my $self = q{]~$self~q[}]~10.chr ?? q{Beautiful!} !! q{Not my type.}}'
<pre>$ narcissist='EVAL my $self = q{say slurp() eq q[EVAL my $self = q{]~$self~q[}]~10.chr ?? q{Beautiful!} !! q{Not my type.}}'
$ perl6 -e "$narcissist" <<<"$narcissist"
$ perl6 -e "$narcissist" <<<"$narcissist"
Beautiful!
Beautiful!