How to resolve the algorithm Narcissist step by step in the Tcl programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Narcissist step by step in the Tcl programming language

Table of Contents

Problem Statement

Quoting from the Esolangs wiki page: For concreteness, in this task we shall assume that symbol = character. The narcissist should be able to cope with any finite input, whatever its length. Any form of output is allowed, as long as the program always halts, and "accept", "reject" and "not yet finished" are distinguishable.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Narcissist step by step in the Tcl programming language

Source code in the tcl programming language

apply {{} {puts [expr {[gets stdin] eq [info level 0]}]}}


apply {s {puts [expr {[gets stdin]eq[list {*}$s $s]}]}} {apply {s {puts [expr {[gets stdin]eq[list {*}$s $s]}]}}}


  

You may also check:How to resolve the algorithm Return multiple values step by step in the Harbour programming language
You may also check:How to resolve the algorithm Primality by trial division step by step in the PL/0 programming language
You may also check:How to resolve the algorithm Hello world/Graphical step by step in the ActionScript programming language
You may also check:How to resolve the algorithm Find palindromic numbers in both binary and ternary bases step by step in the jq programming language
You may also check:How to resolve the algorithm Integer comparison step by step in the Lambdatalk programming language