Skip to content

Commit

Permalink
This approach was the wrong way :-) Nothing like commit driven discus…
Browse files Browse the repository at this point in the history
…sion :-)

This reverts commit 20854f0.
  • Loading branch information
lizmat committed Sep 18, 2013
1 parent 20854f0 commit c2f7f74
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/core/List.pm
Expand Up @@ -73,13 +73,16 @@ my class List does Positional { # declared in BOOTSTRAP
nqp::p6parcel($rpa, Any);
}

method default() { Nil }
multi method at_pos(List:D: \pos) is rw {
return Nil unless self.DEFINITE;
self.gimme(pos + 1);
nqp::existspos($!items, nqp::unbox_i(pos.Int))
?? nqp::atpos($!items, nqp::unbox_i(pos.Int))
!! self.VAR.default;
multi method at_pos(List:D: $pos is copy) is rw {
$pos = $pos.Int;
self.exists($pos)
?? nqp::atpos($!items, nqp::unbox_i($pos))
!! Nil
}
multi method at_pos(List:D: int $pos) is rw {
self.exists($pos)
?? nqp::atpos($!items, $pos)
!! Nil;
}

method eager() { self.gimme(*); self }
Expand Down

0 comments on commit c2f7f74

Please sign in to comment.