Narcissist: Difference between revisions

m
→‎{{header|Phix}}: missing /, or type it in
m (→‎{{header|Phix}}: missing /, or type it in)
 
(7 intermediate revisions by 5 users not shown)
Line 41:
false
error "User cancelled." number -128</syntaxhighlight>
 
=={{header|Arturo}}==
<syntaxhighlight lang="arturo">blk:[print (("blk:" ++ (as .code blk) ++ "do blk") = input "") ? -> "accept" -> "reject"]do blk</syntaxhighlight>
 
{{out}}
 
<pre>$ arturo narcissist.art < narcissist.art
accept</pre>
 
=={{header|AutoHotkey}}==
Line 210 ⟶ 218:
 
=={{header|J}}==
<syntaxhighlight lang="j">#!/j602usr/bin/jconsoleijconsole
main=:3 : 0 NB. tested under j602
self=: '#!/j602/bin/jconsole',LF,'main=:',(5!:5<'main'),LF,'main''''',LF
echo self -: stdin''
Line 408 ⟶ 416:
 
=={{header|Phix}}==
<!--<syntaxhighlight lang="phix">(notonline)-->
<syntaxhighlight lang="phix">
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (file i/o)</span>
printf(1,"\n\n%t\n\n",get_text(command_line()[2],GT_LF_LAST)[1]=gets(0))
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,{</span><span style="color: #008000;">"\n\ntrue\n\n"</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\n\nfalse\n\n"</span><span style="color: #0000FF;">}[</span><span style="color: #000000;">1</span><span style="color: #0000FF;">+(</span><span style="color: #7060A8;">gets</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">open</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">command_line</span><span style="color: #0000FF;">()[</span><span style="color: #000000;">2</span><span style="color: #0000FF;">],</span><span style="color: #008000;">"r"</span><span style="color: #0000FF;">))!=</span><span style="color: #7060A8;">gets</span><span style="color: #0000FF;">(</span><span style="color: #000000;">0</span><span style="color: #0000FF;">))])</span>
<!--</syntaxhighlight>-->
{{out}}
Can be run using <code>p test.exw < test.exw</code> or the input manually typed in
<pre>
true
</pre>
<small>Aside: I suppose there should really be a leading <code>without js -- file i/o</code>, but I wanted to keep it a 1-liner.<br>
Interpreted-only, as is: to allow a compiled version to run, change <code>command_line()[2]</code> to (say) <code>"test.exw"</code><br>
or maybe <code>substitute(command_line()[2],".exe",".exw")</code>, and ship with/install the source code file.</small>
 
=={{header|PicoLisp}}==
Line 538 ⟶ 554:
1: 1
</pre>
=={{header|RPL}}==
« LASTARG RCL →STR == » '<span style="color:blue">NARCISSIST</span>' STO
 
"« LASTARG RCL →STR == »" '<span style="color:blue">NARCISSIST</span>' EVAL <span style="color:grey">@ returns 1</span>
"string" '<span style="color:blue">NARCISSIST</span>' EVAL <span style="color:grey">@ returns 0</span>
=={{header|Ruby}}==
Translation of the C version.
Line 671 ⟶ 692:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">import "os" for Process, Platform
import "io" for File, Stdin, Stdout
 
7,795

edits