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

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Narcissist step by step in the PowerShell 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 PowerShell programming language

Source code in the powershell programming language

function Narcissist
{
Param ( [string]$String )
If ( $String -eq $MyInvocation.MyCommand.Definition ) { 'Accept' }
Else { 'Reject' }
}


Narcissist 'Banana'
 
Narcissist @'

Param ( [string]$String )
If ( $String -eq $MyInvocation.MyCommand.Definition ) { 'Accept' }
Else { 'Reject' }

'@


  

You may also check:How to resolve the algorithm Remove lines from a file step by step in the 11l programming language
You may also check:How to resolve the algorithm Integer overflow step by step in the Befunge programming language
You may also check:How to resolve the algorithm Polynomial long division step by step in the 11l programming language
You may also check:How to resolve the algorithm Miller–Rabin primality test step by step in the Perl programming language
You may also check:How to resolve the algorithm Substring/Top and tail step by step in the jq programming language