README

NAME

Array::Shaped::Console - Renders 2d arrays to a console using block symbols

SYNOPSIS

use Array::Shaped::Console;

my @array[2;2] = (-1,1;1,-1);
# Prints "โ–กโ–ง\nโ–งโ–ก\n"  using default "grayscale" console symbols array
printed(@array).say;

# Prints "โ–กโ– \nโ– โ–ก\n" with infinity having a special default symbol.
@array = (-1,Inf;Inf,-1);
say printed( @array );

DESCRIPTION

Array::Shaped::Console includes functions and ranges to easily render numeric 2d arrays to the console, using the same shape of the array, and adapting the array range to the number of symbols that are also handled in the function.

These arrays, as well as the "infinity" symbol, are predefined;

@grayscale = chr(0x25A1)..chr(0x25A9);
@dashes = 'โ€“'..'โ€•';
@lines = 'โŽฝ'...'โŽบ';
@shades = 'โ–‘'..'โ–“';
@lower = 'โ–'..'โ–ˆ';
@left = 'โ–'...'โ–ˆ';
@squares = <โ–ชโ—พโ—ผ>;
@chars = ".:-=+*#%@".comb;
$inf-char = chr(0x25A0);

@grayscale is used by default.

method printed( @array, @shapes = @grayscale, inf-char)

Returns a string that collates, using the array shape, in a single string that separates rows by a carriage return.

AUTHOR

JJ Merelo [email protected]

COPYRIGHT AND LICENSE

Copyright 2020-2022 JJ Merelo

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Array::Shaped::Console v0.0.3

Renders 2D arrays to a console using block symbols

Authors

  • JJ Merelo

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Array::Shaped::Console

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.