Narcissist: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 94: | Line 94: | ||
Only checks the first line of stdin: |
Only checks the first line of stdin: |
||
<lang lisp>#1=(PRINT (EQUAL (WRITE-TO-STRING '#1# :CIRCLE 1) (READ-LINE *STANDARD-INPUT*)))</lang> |
<lang lisp>#1=(PRINT (EQUAL (WRITE-TO-STRING '#1# :CIRCLE 1) (READ-LINE *STANDARD-INPUT*)))</lang> |
||
=={{header|D}}== |
=={{header|D}}== |
||
<lang D>import std.file; import std.stdio; import std.string; void main() { auto source = readText("narcissist.d").chomp; auto input = readln().chomp(); if (source == input) writeln("accept"); else writeln("reject"); }</lang> |
<lang D>import std.file; import std.stdio; import std.string; void main() { auto source = readText("narcissist.d").chomp; auto input = readln().chomp(); if (source == input) writeln("accept"); else writeln("reject"); }</lang> |
||
Line 275: | Line 276: | ||
{{works with|Julia|1.2}} |
{{works with|Julia|1.2}} |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
<lang julia>mysource = Base.read(Base.source_path(), String) |
<lang julia>mysource = Base.read(Base.source_path(), String) |
||
Line 367: | Line 369: | ||
<pre>narcissist() = {input() == narcissist;} |
<pre>narcissist() = {input() == narcissist;} |
||
1</pre> |
1</pre> |
||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
<lang perl># this is file narc.pl |
<lang perl># this is file narc.pl |
||
Line 373: | Line 376: | ||
Run: |
Run: |
||
<lang>perl narc.pl < narc.pl</lang> |
<lang>perl narc.pl < narc.pl</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 456: | Line 443: | ||
#t |
#t |
||
</lang> |
</lang> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
Line 485: | Line 489: | ||
if (lines.mkString("\r\n") == text) println("\naccept") else println("\nreject") |
if (lines.mkString("\r\n") == text) println("\naccept") else println("\nreject") |
||
}</lang> |
}</lang> |
||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<lang ruby>say (File.new(__FILE__).open_r.slurp == ARGF.slurp);</lang> |
<lang ruby>say (File.new(__FILE__).open_r.slurp == ARGF.slurp);</lang> |
||
Line 536: | Line 541: | ||
<pre>$ txr narcissist.txr narcissist.txr |
<pre>$ txr narcissist.txr narcissist.txr |
||
1</pre> |
1</pre> |
||
⚫ | |||
⚫ | |||
=={{header|VBA}}== |
=={{header|VBA}}== |
||
Line 581: | Line 589: | ||
Debug.Print IIf(flag, 1, 0) |
Debug.Print IIf(flag, 1, 0) |
||
End Sub</lang> |
End Sub</lang> |
||
⚫ | |||
⚫ | |||
=={{header|zkl}}== |
=={{header|zkl}}== |