daily pastebin goal
21%
SHARE
TWEET

Untitled

a guest Jan 18th, 2018 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use v6;
  2. use Test;
  3. use Data::StaticTable;
  4.  
  5. my $t10 = Data::StaticTable.new(
  6.      <Attr          Dim1   Dim2    Dim3    Dim4>, #--   <- Header
  7.     (
  8.     'attribute-1',  1,      2,      3,      'D+', # Row 1
  9.     'attribute-2',  4,      5,      6,      'B+', # Row 2
  10.     'attribute-3',  7,      8,      9,      'A-', # Row 3
  11.     'attribute-4', ('ALPHA',                      # \\\\\
  12.                     'BETA',                       # Row 4
  13.                      3.0),  5,      6,      'A++',# \\\\\
  14.     'attribute-10', 0,      0,      0,      'Z',  # Row 5
  15.     'attribute-11', (-2 .. 2), Nil, Nil,    'X'   # Row 6
  16.     )
  17. );
  18. diag $t10[1].perl;             #{:Attr("attribute-1"), :Dim1(1), :Dim2(2), :Dim3(3), :Dim4("D+")}
  19. diag $t10[4].perl;             #{:Attr("attribute-4"), :Dim1($("ALPHA", "BETA", 3.0)), :Dim2(5), :Dim3(6), :Dim4("A++")}
  20. diag $t10[4]<Dim1>[0];         # 'ALPHA'
  21. diag $t10.get-cell("Dim1", 6); # -2 .. 2
  22.  
  23. my @shape = $t10.get-shaped-array();
  24. diag @shape[3;1;0]; #'ALPHA'
  25. diag @shape[3;1;1]; #'BETA'
  26. diag @shape[3;1;2]; # 3
  27. diag @shape[1;2];   # 7
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top