Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use v6;
- use Test;
- use Data::StaticTable;
- my $t10 = Data::StaticTable.new(
- <Attr Dim1 Dim2 Dim3 Dim4>, #-- <- Header
- (
- 'attribute-1', 1, 2, 3, 'D+', # Row 1
- 'attribute-2', 4, 5, 6, 'B+', # Row 2
- 'attribute-3', 7, 8, 9, 'A-', # Row 3
- 'attribute-4', ('ALPHA', # \\\\\
- 'BETA', # Row 4
- 3.0), 5, 6, 'A++',# \\\\\
- 'attribute-10', 0, 0, 0, 'Z', # Row 5
- 'attribute-11', (-2 .. 2), Nil, Nil, 'X' # Row 6
- )
- );
- diag $t10[1].perl; #{:Attr("attribute-1"), :Dim1(1), :Dim2(2), :Dim3(3), :Dim4("D+")}
- diag $t10[4].perl; #{:Attr("attribute-4"), :Dim1($("ALPHA", "BETA", 3.0)), :Dim2(5), :Dim3(6), :Dim4("A++")}
- diag $t10[4]<Dim1>[0]; # 'ALPHA'
- diag $t10.get-cell("Dim1", 6); # -2 .. 2
- my @shape = $t10.get-shaped-array();
- diag @shape[3;1;0]; #'ALPHA'
- diag @shape[3;1;1]; #'BETA'
- diag @shape[3;1;2]; # 3
- diag @shape[1;2]; # 7
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement