How to resolve the algorithm Show ASCII table step by step in the Raku programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Show ASCII table step by step in the Raku programming language

Table of Contents

Problem Statement

Show  the ASCII character set  from values   32   to   127   (decimal)   in a table format.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Show ASCII table step by step in the Raku programming language

Source code in the raku programming language

sub glyph ($_) {
    when * < 33 { (0x2400 + $_).chr } # display symbol names for invisible glyphs
    when 127    { '␡' }
    default     { .chr }
}

say '{|class="wikitable" style="text-align:center;background-color:hsl(39, 90%, 95%)"';

for (^128).rotor(16) -> @row {
    say '|-';
    printf(q[|%d
0x%02X
%s] ~ "\n",
$_, $_, .&glyph.uniname.subst('SYMBOL FOR ', ''), .&glyph.subst('|', '|')) for @row; } say '|}';

You may also check:How to resolve the algorithm Maze generation step by step in the Perl programming language
You may also check:How to resolve the algorithm Prime triangle step by step in the Raku programming language
You may also check:How to resolve the algorithm Function definition step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Algebraic data types step by step in the Erlang programming language
You may also check:How to resolve the algorithm Greatest common divisor step by step in the Mathematica / Wolfram Language programming language