Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Match.keys, List.kv, pop returns undef, Hash.exists and delete fo…
…r Rakudo compatibility
  • Loading branch information
sorear committed May 26, 2011
1 parent ca9fc3e commit a828415
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/CORE.setting
Expand Up @@ -700,6 +700,8 @@ my class List is Cool {
method shift() { self ?? self!shift-item !! Any }
method pop() { (+self) ?? self!pop-item !! Any }
method eager() { +self; self }
method head() { self ??
Expand Down Expand Up @@ -752,11 +754,11 @@ my class List is Cool {
{Nil})
} }
method pop() { +self; self!pop-item; }
method unshift(*@a) {
for reverse(@a) -> $v { self!unshift-item(anon $new = $v) }
}
method kv() { my $i = 0; self.map({ $i++, $_ }) }
}
my class Array is List {
Expand Down Expand Up @@ -835,6 +837,10 @@ my class Hash {
};
}
# Rakudo extensions compatibility - DO NOT USE
method delete($key) { self.{$key}:delete }
method exists($key) { self.{$key}:exists }

method perl(\$self:) {
$self // return $self.typename;
'{' ~ @($self).map(*.perl).join(', ') ~ '}' ~
Expand Down Expand Up @@ -1106,6 +1112,7 @@ my class Match is Cool {
method flat () { @( self.Capture ) }
method iterator () { self.flat.iterator }
method Numeric() { +(~self) }
method keys () { keys %(self) }
method Capture () { Q:CgOp {
(letn cap (obj_newblank (obj_llhow (@ {Capture})))
(cursor_unpackcaps (cast cursor (@ {self})) (l cap))
Expand Down

0 comments on commit a828415

Please sign in to comment.