| a | b | |
|---|
| 0 | | - | 20:49 ~/g/code/p6/t$ cat Tree/LLRB.pm6 |
|---|
| 0 | + | 21:09 ~/g/code/p6/t$ cat Tree/LLRB.pm6 |
|---|
| ... | |
|---|
| 1 | 1 | | class Tree::LLRB { |
|---|
| 2 | 2 | | class Node { |
|---|
| 3 | 3 | | has $.key is rw; |
|---|
| ... | |
|---|
| 7 | 7 | | has $.color is rw; |
|---|
| 8 | 8 | | |
|---|
| 9 | 9 | | method new($key, $val) { |
|---|
| ... | |
|---|
| 10 | | - | $.key = $key; |
|---|
| 10 | | - | $.val = $val; |
|---|
| 10 | | - | # True == Red, False == Black |
|---|
| 10 | | - | $.color = True; |
|---|
| 10 | + | nextwith(self, :$key, :$val, :color<True>) |
|---|
| ... | |
|---|
| 14 | 14 | | } |
|---|
| 15 | 15 | | |
|---|
| 16 | 16 | | method colorFlip() { |
|---|
| ... | |
|---|
| 88 | 88 | | } |
|---|
| 89 | 89 | | } |
|---|
| 90 | 90 | | } |
|---|
| ... | |
|---|
| 91 | | - | 20:49 ~/g/code/p6/t$ perl6 -e 'use Tree::LLRB; Tree::LLRB.new().insert(1, True).dump()' |
|---|
| 91 | | - | Type objects are abstract and have no attributes, but you tried to access $!key |
|---|
| 91 | | - | in 'Node::new' at line 10:Tree/LLRB.pm6 |
|---|
| 91 | | - | in 'Tree::LLRB::insert_at_node' at line 56:Tree/LLRB.pm6 |
|---|
| 91 | | - | in 'Tree::LLRB::insert' at line 50:Tree/LLRB.pm6 |
|---|
| 91 | + | 21:09 ~/g/code/p6/t$ perl6 -e 'use Tree::LLRB; Tree::LLRB.new().insert(1, True).dump()' |
|---|
| 91 | + | too many positional arguments: 2 passed, 1 expected |
|---|
| 91 | + | in 'Node::new' at line 1 |
|---|
| 91 | + | in 'Tree::LLRB::insert_at_node' at line 53:Tree/LLRB.pm6 |
|---|
| 91 | + | in 'Tree::LLRB::insert' at line 47:Tree/LLRB.pm6 |
|---|
| ... | |
|---|
| 96 | 96 | | in main program body at line 1 |
|---|
| 97 | 97 | | |
|---|
| ... | |
|---|