How to resolve the algorithm Trabb Pardo–Knuth algorithm step by step in the Raku programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Trabb Pardo–Knuth algorithm step by step in the Raku programming language

Table of Contents

Problem Statement

The TPK algorithm is an early example of a programming chrestomathy. It was used in Donald Knuth and Luis Trabb Pardo's Stanford tech report The Early Development of Programming Languages. The report traces the early history of work in developing computer languages in the 1940s and 1950s, giving several translations of the algorithm. From the wikipedia entry: The task is to implement the algorithm:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Trabb Pardo–Knuth algorithm step by step in the Raku programming language

Source code in the raku programming language

my @nums = prompt("Please type 11 space-separated numbers: ").words
    until @nums == 11;
for @nums.reverse -> $n {
    my $r = $n.abs.sqrt + 5 * $n ** 3;
    say "$n\t{ $r > 400 ?? 'Urk!' !! $r }";
}


  

You may also check:How to resolve the algorithm Fork step by step in the zkl programming language
You may also check:How to resolve the algorithm Create a file step by step in the D programming language
You may also check:How to resolve the algorithm Polyspiral step by step in the Fōrmulæ programming language
You may also check:How to resolve the algorithm Dot product step by step in the Scilab programming language
You may also check:How to resolve the algorithm Word frequency step by step in the Raku programming language