Narcissist: Difference between revisions

Content added Content deleted
m (Use Template:Task instead of Template:Puzzle. The Puzzle template's meaning is rather vague, and there is probably a better way to handle that information.)
No edit summary
Line 48: Line 48:
<pre>: (narcissist "(Str) (= Str (str narcissist))")
<pre>: (narcissist "(Str) (= Str (str narcissist))")
-> T</pre>
-> T</pre>

=={{header|Ruby}}==
Translation of the C version.
<lang ruby>s = "s = %s%s%s; puts(gets.chomp == (s %% [34.chr, s, 34.chr]) ? 'accept' : 'reject')"; puts(gets.chomp == (s % [34.chr, s, 34.chr]) ? 'accept' : 'reject')</lang>
Output:
<pre>$ ruby narcissist.rb < narcissist.rb
accept</pre>


=={{header|Tcl}}==
=={{header|Tcl}}==