Following discussion on #perl6 yesterday:

http://irclog.perlgeek.de/perl6/2013-02-09#i_6433552

We figured that

1) Rakudo's delete for Arrays is, um, completely lacking in awesome
2) it's possible to eliminate two NQP ops, deletepos and existspos
   deletepos "should" be used, but isn't, for delete on array
   existspos is used in 5 places.
   it can be removed by recoding those in terms of the array size, and
   nqp::isnull
3) we think that delete of an array element can be (properly) implemented by
   binding nqp::null
   (but as it's not currently implemented correctly, and no tests get upset,
   I didn't fix this.)

This gets rid of two somewhat troublesome NQP ops. It means that NQP doesn't
assume that the underlying VM can do some sort of sparseness. But it does
assume that it's able to bind a null into a slot in the array. (Which is
pretty much how Parrot and the JVM prototype were doing it anyway, and
seems reasonable.

To make the refactoring easier, Jonathan thought it reasonable to constrain
that the various at_pos() methods in Rakudo's setting enforce that the
position parameter is non-negative. Currently that constraint is enforced
in the postfix [] operator.

So the first Rakudo patch does that. The next three remove nqp::existspos.
With that done, one can then use the 2 NQP patches to eliminate the ops.

The speed of array accesses is not changed. (see RT #111848)

I've no idea if the coding style is appropriate. Whether the indentation is
crazy. Whether one should be using Mu. etc

But it does work :-)
[Including the spectests. But why should you trust me on that? :-)]

Nicholas Clark
>From 2c73f49baaaa51bf43c046e42780fefbb0d35720 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Sun, 10 Feb 2013 18:44:59 +0100
Subject: [PATCH 1/4] Move the test for negative indices from postcircumfix:<[ ]> to at_pos().

at_pos() shouldn't accept negative indices when called directly either.
Having the check in two places duplicates work.
---
 src/core/Any.pm     |   13 +------------
 src/core/Array.pm   |    4 ++++
 src/core/Buf.pm     |    1 +
 src/core/Capture.pm |    1 +
 src/core/List.pm    |    1 +
 src/core/LoL.pm     |    1 +
 6 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/core/Any.pm b/src/core/Any.pm
index 2bca541..99b6b47 100644
--- a/src/core/Any.pm
+++ b/src/core/Any.pm
@@ -153,7 +153,6 @@ my class Any {
         X::Bind::ZenSlice.new(type => self.WHAT).throw
     }
     multi method postcircumfix:<[ ]>(\SELF: $pos) is rw {
-        fail "Cannot use negative index $pos on {SELF.WHAT.perl}" if $pos < 0;
         SELF.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>($pos, Mu :$BIND! is parcel) is rw {
@@ -161,19 +160,15 @@ my class Any {
         self.bind_pos($pos, $BIND)
     }
     multi method postcircumfix:<[ ]>($pos, :$p!) is rw {
-        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $p ?? RWPAIR($pos, self.at_pos($pos)) !! self.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>($pos, :$kv!) is rw {
-        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $kv ?? ($pos, self.at_pos($pos)) !! self.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>($pos, :$k!) is rw {
-        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $k ?? $pos !! self.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>(\SELF: int $pos) is rw {
-        fail "Cannot use negative index $pos on {SELF.WHAT.perl}" if $pos < 0;
         SELF.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>(int $pos, Mu :$BIND! is parcel) is rw {
@@ -181,20 +176,16 @@ my class Any {
         self.bind_pos($pos, $BIND)
     }
     multi method postcircumfix:<[ ]>(int $pos, :$p!) is rw {
-        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $p ?? RWPAIR($pos, self.at_pos($pos)) !! self.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>(int $pos, :$kv!) is rw {
-        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $kv ?? ($pos, self.at_pos($pos)) !! self.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>(int $pos, :$k!) is rw {
-        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $k ?? $pos !! self.at_pos($pos)
     }
     multi method postcircumfix:<[ ]>(\SELF: Positional \pos) is rw {
         if nqp::iscont(pos) {
-            fail "Cannot use negative index {pos} on {SELF.WHAT.perl}" if pos < 0;
             return SELF.at_pos(pos)
         }
         my $list = pos.flat;
@@ -205,7 +196,6 @@ my class Any {
     }
     multi method postcircumfix:<[ ]>(\SELF: Positional \pos, :$p!) is rw {
         if nqp::iscont(pos) {
-            fail "Cannot use negative index {pos} on {SELF.WHAT.perl}" if pos < 0;
             return RWPAIR(pos, SELF.at_pos(pos))
         }
         my $list = pos.flat;
@@ -214,7 +204,6 @@ my class Any {
     }
     multi method postcircumfix:<[ ]>(\SELF: Positional \pos, :$kv!) is rw {
         if nqp::iscont(pos) {
-            fail "Cannot use negative index {pos} on {SELF.WHAT.perl}" if pos < 0;
             return (pos, SELF.at_pos(pos))
         }
         my $list = pos.flat;
@@ -232,7 +221,6 @@ my class Any {
     }
     multi method postcircumfix:<[ ]>(\SELF: Positional \pos, :$v!) is rw {
         if nqp::iscont(pos) {
-            fail "Cannot use negative index {pos} on {SELF.WHAT.perl}" if pos < 0;
             SELF.at_pos(pos)
         }
         my $list = pos.flat;
@@ -283,6 +271,7 @@ my class Any {
         self;
     }
     multi method at_pos(Any:U \SELF: $pos) is rw {
+	fail "Cannot use negative index $pos on {SELF.WHAT.perl}" if $pos < 0;
         pir::setattribute__0PPsP(my $v, Scalar, '$!whence',
             -> { SELF.defined || &infix:<=>(SELF, Array.new);
                  SELF.bind_pos($pos, $v) });
diff --git a/src/core/Array.pm b/src/core/Array.pm
index cb67207..17083d3 100644
--- a/src/core/Array.pm
+++ b/src/core/Array.pm
@@ -13,6 +13,7 @@ class Array {
         if nqp::isnanorinf($pos) {
             X::Item.new(aggregate => self, index => $pos).throw;
         }
+        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         my int $p = nqp::unbox_i($pos.Int);
         my Mu $items := nqp::p6listitems(self);
         # hotpath check for element existence (RT #111848)
@@ -24,6 +25,7 @@ class Array {
                  -> { nqp::bindpos($items, $p, $v) } )
     }
     multi method at_pos(Array:D: int $pos) is rw {
+        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         my Mu $items := nqp::p6listitems(self);
         # hotpath check for element existence (RT #111848)
         nqp::existspos($items, $pos)
@@ -106,6 +108,7 @@ class Array {
 
     my role TypedArray[::TValue] does Positional[TValue] {
         multi method at_pos($pos is copy, TValue $v? is copy) is rw {
+            fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
             $pos = $pos.Int;
             self.exists($pos)
               ?? nqp::atpos(nqp::getattr(self, List, '$!items'), nqp::unbox_i($pos))
@@ -113,6 +116,7 @@ class Array {
                      -> { nqp::bindpos(nqp::getattr(self, List, '$!items'), nqp::unbox_i($pos), $v) } )
         }
         multi method at_pos(int $pos, TValue $v? is copy) is rw {
+            fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
             self.exists($pos)
               ?? nqp::atpos(nqp::getattr(self, List, '$!items'), $pos)
               !! pir::setattribute__0PPsP($v, Scalar, '$!whence',
diff --git a/src/core/Buf.pm b/src/core/Buf.pm
index 9560b26..7b58450 100644
--- a/src/core/Buf.pm
+++ b/src/core/Buf.pm
@@ -31,6 +31,7 @@ my class Buf does Positional {
     }
 
     method at_pos(Buf:D: Int:D $idx) {
+        fail "Cannot use negative index $idx on {self.WHAT.perl}" if $idx < 0;
         nqp::p6box_i(nqp::ord(nqp::substr($!buffer, nqp::unbox_i($idx), 1)));
     }
 
diff --git a/src/core/Capture.pm b/src/core/Capture.pm
index 20458c2..ac80cc9 100644
--- a/src/core/Capture.pm
+++ b/src/core/Capture.pm
@@ -17,6 +17,7 @@ my class Capture {
     }
 
     method at_pos(Capture:D: $pos is copy) {
+	fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $pos = $pos.Int;
         nqp::existspos($!list, nqp::unbox_i($pos))
           ?? nqp::atpos($!list, nqp::unbox_i($pos))
diff --git a/src/core/List.pm b/src/core/List.pm
index 84f7eff..c7428c5 100644
--- a/src/core/List.pm
+++ b/src/core/List.pm
@@ -73,6 +73,7 @@ my class List does Positional {
 
     multi method at_pos(List:D: $pos is copy) is rw {
         $pos = $pos.Int;
+        fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         self.exists($pos)
           ?? nqp::atpos($!items, nqp::unbox_i($pos))
           !! Nil
diff --git a/src/core/LoL.pm b/src/core/LoL.pm
index f57f613..0e0cce8 100644
--- a/src/core/LoL.pm
+++ b/src/core/LoL.pm
@@ -9,6 +9,7 @@ class LoL {
     }
     
     method at_pos($pos is copy) {
+	fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $pos = $pos.Int;
         self.exists($pos)
           ?? nqp::findmethod(List, 'at_pos')(self, $pos)
-- 
1.7.2.5

>From aa70b9e2a2a3af6dc436e495aedfbcc8b3bf3df3 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Sun, 10 Feb 2013 20:09:50 +0100
Subject: [PATCH 2/4] Refactor Array.at_pos() to remove the use of nqp::existspos().

---
 src/core/Array.pm |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/src/core/Array.pm b/src/core/Array.pm
index 17083d3..cf29647 100644
--- a/src/core/Array.pm
+++ b/src/core/Array.pm
@@ -16,23 +16,35 @@ class Array {
         fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         my int $p = nqp::unbox_i($pos.Int);
         my Mu $items := nqp::p6listitems(self);
-        # hotpath check for element existence (RT #111848)
-        nqp::existspos($items, $p)
-              || nqp::getattr(self, List, '$!nextiter').defined
-                  && self.exists($p)
-          ?? nqp::atpos($items, $p)
-          !! pir::setattribute__0PPsP(my $v, Scalar, '$!whence',
+        my Mu $count := nqp::elems($items);
+        if $p >= 0 && $p < $count {
+            # hotpath check for element existence (RT #111848)
+            my Mu $item := nqp::atpos($items, $p);
+            if !nqp::isnull($item) {
+                return-rw $item;
+            }
+        } elsif nqp::getattr(self, List, '$!nextiter').defined
+                  && self.exists($p) {
+                return-rw nqp::atpos($items, $p)
+             }
+        return-rw pir::setattribute__0PPsP(my $v, Scalar, '$!whence',
                  -> { nqp::bindpos($items, $p, $v) } )
     }
     multi method at_pos(Array:D: int $pos) is rw {
         fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         my Mu $items := nqp::p6listitems(self);
-        # hotpath check for element existence (RT #111848)
-        nqp::existspos($items, $pos)
-              || nqp::getattr(self, List, '$!nextiter').defined
-                  && self.exists($pos)
-          ?? nqp::atpos($items, $pos)
-          !! pir::setattribute__0PPsP(my $v, Scalar, '$!whence',
+        my Mu $count := nqp::elems($items);
+        if $pos >= 0 && $pos < $count {
+            # hotpath check for element existence (RT #111848)
+            my Mu $item := nqp::atpos($items, $pos);
+            if !nqp::isnull($item) {
+                return-rw $item;
+            }
+        } elsif nqp::getattr(self, List, '$!nextiter').defined
+                  && self.exists($pos) {
+                return-rw nqp::atpos($items, $pos)
+             }
+        return-rw pir::setattribute__0PPsP(my $v, Scalar, '$!whence',
                  -> { nqp::bindpos($items, $pos, $v) } )
     }
 
-- 
1.7.2.5

>From c6a46c868a90e678ef483e27f254f857340d8c35 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Sun, 10 Feb 2013 20:30:22 +0100
Subject: [PATCH 3/4] Refactor List.exists() and .shift() to remove the use of nqp::existspos().

---
 src/core/List.pm |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/core/List.pm b/src/core/List.pm
index c7428c5..d755b91 100644
--- a/src/core/List.pm
+++ b/src/core/List.pm
@@ -95,7 +95,9 @@ my class List does Positional {
 
     method exists(\pos) {
         self.gimme(pos + 1);
-        nqp::p6bool(nqp::existspos($!items, nqp::unbox_i(pos)))
+        my Mu $count := nqp::elems($!items);
+	return False if pos < 0 || pos > $count;
+        nqp::p6bool(!nqp::isnull(nqp::atpos($!items, nqp::unbox_i(pos))))
     }
 
     method gimme($n, :$sink) {
@@ -217,7 +219,7 @@ my class List does Positional {
 
     method shift() is rw {
         # make sure we have at least one item, then shift+return it
-        nqp::islist($!items) && nqp::existspos($!items, 0) || self.gimme(1)
+        nqp::islist($!items) && !nqp::isnull(nqp::atpos($!items, 0)) || self.gimme(1)
           ?? nqp::shift($!items) 
           !! fail 'Element shifted from empty list';
     }
-- 
1.7.2.5

>From f544cc5071a052bf9aae32ada9687f4bcedfec94 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Sun, 10 Feb 2013 20:44:37 +0100
Subject: [PATCH 4/4] Refactor Capture::at_pos() to remove the use of nqp::existspos().

---
 src/core/Capture.pm |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/core/Capture.pm b/src/core/Capture.pm
index ac80cc9..a87b46a 100644
--- a/src/core/Capture.pm
+++ b/src/core/Capture.pm
@@ -19,9 +19,10 @@ my class Capture {
     method at_pos(Capture:D: $pos is copy) {
 	fail "Cannot use negative index $pos on {self.WHAT.perl}" if $pos < 0;
         $pos = $pos.Int;
-        nqp::existspos($!list, nqp::unbox_i($pos))
-          ?? nqp::atpos($!list, nqp::unbox_i($pos))
-          !! Any
+	my Mu $item := nqp::atpos($!list, nqp::unbox_i($pos));
+	nqp::isnull($item)
+          ?? Any
+          !! $item
     }
 
     method hash(Capture:D:) {
-- 
1.7.2.5

>From 3c49d75f2128b58f80a48ee3f59b036ddf3f11df Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Sat, 9 Feb 2013 19:18:21 +0100
Subject: [PATCH 1/2] Delete nqp::deletepos (and its tests), as Rakudo doesn't use it.

---
 src/QAST/Operations.nqp |    1 -
 t/nqp/52-vtable.t       |    5 +----
 t/nqp/59-nqpop.t        |   16 +---------------
 3 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/src/QAST/Operations.nqp b/src/QAST/Operations.nqp
index 728632c..d82e357 100644
--- a/src/QAST/Operations.nqp
+++ b/src/QAST/Operations.nqp
@@ -1569,7 +1569,6 @@ QAST::Operations.add_core_pirop_mapping('bindpos_i', 'set', '1Qii', :inlinable(1
 QAST::Operations.add_core_pirop_mapping('bindpos_n', 'set', '1Qin', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('bindpos_s', 'set', '1Qis', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('deletekey', 'delete', '0Qs', :inlinable(1));
-QAST::Operations.add_core_pirop_mapping('deletepos', 'delete', '0Qi', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('existskey', 'exists', 'IQs', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('existspos', 'exists', 'IQi', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('elems', 'elements', 'IP', :inlinable(1));
diff --git a/t/nqp/52-vtable.t b/t/nqp/52-vtable.t
index 807e36c..7debfb1 100644
--- a/t/nqp/52-vtable.t
+++ b/t/nqp/52-vtable.t
@@ -5,7 +5,7 @@ class ABC {
     method () is parrot_vtable('get_string') { 'abc' }
 }
 
-plan(10);
+plan(9);
 
 my $abc := ABC.new;
 ok($abc == 123,   "get_number vtable works");
@@ -42,7 +42,6 @@ class Arrayy {
     method ($k)     is parrot_vtable('get_pmc_keyed_int') { @!a{$k}}
     method ($k, $v) is parrot_vtable('set_pmc_keyed_int') { @!a{$k} := $v }
     method ($k)     is parrot_vtable('exists_keyed_int')  { nqp::existspos(@!a, $k)      }
-    method ($k)     is parrot_vtable('delete_keyed_int')  { nqp::deletepos(@!a, $k)      }
 }
 
 my $a := Arrayy.new; $a.init();
@@ -50,5 +49,3 @@ my $a := Arrayy.new; $a.init();
 $a[0] := 'bar';
 ok($a[0] eq 'bar', '{set,get}_pmc_keyed_int');
 ok(nqp::existspos($a, 0), 'exists');
-nqp::deletepos($a, 0);
-ok(!nqp::existspos($a, 0), 'delete');
diff --git a/t/nqp/59-nqpop.t b/t/nqp/59-nqpop.t
index e30a079..c422a85 100644
--- a/t/nqp/59-nqpop.t
+++ b/t/nqp/59-nqpop.t
@@ -2,7 +2,7 @@
 
 # Test nqp::op pseudo-functions.
 
-plan(116);
+plan(107);
 
 
 ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
@@ -151,17 +151,3 @@ ok(nqp::existspos(@arr2, 1), 'existspos with existing pos');
 ok(!nqp::existspos(@arr2, 2), 'existspos with missing pos');
 ok(nqp::existspos(@arr2, 3), 'existspos with existing pos');
 ok(!nqp::existspos(@arr2, 4), 'existspos with missing pos');
-
-nqp::deletepos(@arr2, 1);
-ok(nqp::elems(@arr2) == 3, 'right number of elements');
-ok(!nqp::existspos(@arr2, 0), 'existspos with existing pos');
-ok(!nqp::existspos(@arr2, 1), 'existspos with missing pos');
-ok(nqp::existspos(@arr2, 2), 'existspos with existing pos');
-ok(!nqp::existspos(@arr2, 3), 'existspos with missing pos');
-
-nqp::deletepos(@arr2, 0);
-
-ok(nqp::elems(@arr2) == 2, 'right number of elements');
-ok(!nqp::existspos(@arr2, 0), 'existspos with existing pos');
-ok(nqp::existspos(@arr2, 1), 'existspos with missing pos');
-ok(!nqp::existspos(@arr2, 2), 'existspos with existing pos');
-- 
1.7.2.5

>From b79a62ed0713ddb84ce31cd4a2688e00f9686099 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <n...@ccl4.org>
Date: Sun, 10 Feb 2013 21:15:30 +0100
Subject: [PATCH 2/2] Delete nqp::existspos (and its tests), as Rakudo no longer uses it.

---
 src/QAST/Operations.nqp |    1 -
 t/nqp/52-vtable.t       |    4 +---
 t/nqp/59-nqpop.t        |   24 +-----------------------
 3 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/src/QAST/Operations.nqp b/src/QAST/Operations.nqp
index d82e357..c5f3580 100644
--- a/src/QAST/Operations.nqp
+++ b/src/QAST/Operations.nqp
@@ -1570,7 +1570,6 @@ QAST::Operations.add_core_pirop_mapping('bindpos_n', 'set', '1Qin', :inlinable(1
 QAST::Operations.add_core_pirop_mapping('bindpos_s', 'set', '1Qis', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('deletekey', 'delete', '0Qs', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('existskey', 'exists', 'IQs', :inlinable(1));
-QAST::Operations.add_core_pirop_mapping('existspos', 'exists', 'IQi', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('elems', 'elements', 'IP', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('push', 'push', '0PP', :inlinable(1));
 QAST::Operations.add_core_pirop_mapping('push_s', 'push', '0Ps', :inlinable(1));
diff --git a/t/nqp/52-vtable.t b/t/nqp/52-vtable.t
index 7debfb1..d987be5 100644
--- a/t/nqp/52-vtable.t
+++ b/t/nqp/52-vtable.t
@@ -5,7 +5,7 @@ class ABC {
     method () is parrot_vtable('get_string') { 'abc' }
 }
 
-plan(9);
+plan(8);
 
 my $abc := ABC.new;
 ok($abc == 123,   "get_number vtable works");
@@ -41,11 +41,9 @@ class Arrayy {
     method init() { @!a := nqp::list() }
     method ($k)     is parrot_vtable('get_pmc_keyed_int') { @!a{$k}}
     method ($k, $v) is parrot_vtable('set_pmc_keyed_int') { @!a{$k} := $v }
-    method ($k)     is parrot_vtable('exists_keyed_int')  { nqp::existspos(@!a, $k)      }
 }
 
 my $a := Arrayy.new; $a.init();
 
 $a[0] := 'bar';
 ok($a[0] eq 'bar', '{set,get}_pmc_keyed_int');
-ok(nqp::existspos($a, 0), 'exists');
diff --git a/t/nqp/59-nqpop.t b/t/nqp/59-nqpop.t
index c422a85..2250af1 100644
--- a/t/nqp/59-nqpop.t
+++ b/t/nqp/59-nqpop.t
@@ -2,7 +2,7 @@
 
 # Test nqp::op pseudo-functions.
 
-plan(107);
+plan(94);
 
 
 ok( nqp::add_i(5,2) == 7, 'nqp::add_i');
@@ -129,25 +129,3 @@ my %hash;
 %hash<foo> := 1;
 ok( nqp::existskey(%hash,"foo"),"existskey with existing key");
 ok( !nqp::existskey(%hash,"bar"),"existskey with missing key");
-
-my @arr;
-@arr[1] := 3;
-ok(!nqp::existspos(@arr, 0), 'existspos with missing pos');
-ok(nqp::existspos(@arr, 1), 'existspos with existing pos');
-ok(!nqp::existspos(@arr, 2), 'existspos with missing pos');
-ok(nqp::existspos(@arr, -1), 'existspos with existing pos');
-ok(!nqp::existspos(@arr, -2), 'existspos with missing pos');
-ok(!nqp::existspos(@arr, -100), 'existspos with absurd values');
-@arr[1] := NQPMu;
-ok(nqp::existspos(@arr, 1), 'existspos with still existing pos');
-
-# for deletepos
-my @arr2;
-@arr2[1] := 1;
-@arr2[3] := 1;
-ok(nqp::elems(@arr2) == 4, 'right number of elements');
-ok(!nqp::existspos(@arr2, 0), 'existspos with missing pos');
-ok(nqp::existspos(@arr2, 1), 'existspos with existing pos');
-ok(!nqp::existspos(@arr2, 2), 'existspos with missing pos');
-ok(nqp::existspos(@arr2, 3), 'existspos with existing pos');
-ok(!nqp::existspos(@arr2, 4), 'existspos with missing pos');
-- 
1.7.2.5

Reply via email to