develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33697 - in branches/assign/languages/perl6: src/classes t

From:
pmichaud
Date:
December 8, 2008 22:09
Subject:
[svn:parrot] r33697 - in branches/assign/languages/perl6: src/classes t
Message ID:
20081209060953.2349ECB9AF@x12.develooper.com
Author: pmichaud
Date: Mon Dec  8 22:09:52 2008
New Revision: 33697

Modified:
   branches/assign/languages/perl6/src/classes/Array.pir
   branches/assign/languages/perl6/src/classes/List.pir
   branches/assign/languages/perl6/t/spectest.data

Log:
[rakudo]:  Update list and values methods a bit.


Modified: branches/assign/languages/perl6/src/classes/Array.pir
==============================================================================
--- branches/assign/languages/perl6/src/classes/Array.pir	(original)
+++ branches/assign/languages/perl6/src/classes/Array.pir	Mon Dec  8 22:09:52 2008
@@ -93,6 +93,18 @@
 .end
 
 
+=item list
+
+Return invocant as a List.
+
+=cut
+
+.namespace ['Perl6Array']
+.sub 'list' :method
+    .tailcall self.'values'()
+.end
+
+
 =item pop()
 
 Remove the last item from the array and return it.
@@ -157,6 +169,19 @@
     .tailcall self.'elems'()
 .end
 
+=item values()
+
+Return Array as a List of its values.
+
+=cut
+
+.namespace ['Perl6Array']
+.sub 'values' :method
+    $P0 = new 'List'
+    splice $P0, self, 0, 0
+    .return ($P0)
+.end
+
 =back
 
 =head2 Operators

Modified: branches/assign/languages/perl6/src/classes/List.pir
==============================================================================
--- branches/assign/languages/perl6/src/classes/List.pir	(original)
+++ branches/assign/languages/perl6/src/classes/List.pir	Mon Dec  8 22:09:52 2008
@@ -23,6 +23,17 @@
 
 =over
 
+=item item
+
+A List in item context becomes an Array.
+
+=cut
+
+.namespace ['List']
+.sub 'item' :method
+    .tailcall self.'Array'()
+.end
+
 =item list
 
 A List in list context returns itself.

Modified: branches/assign/languages/perl6/t/spectest.data
==============================================================================
--- branches/assign/languages/perl6/t/spectest.data	(original)
+++ branches/assign/languages/perl6/t/spectest.data	Mon Dec  8 22:09:52 2008
@@ -52,7 +52,6 @@
 S03-operators/assign.t
 S03-operators/autoincrement.t
 S03-operators/autovivification.t
-S03-operators/binding-arrays.t
 S03-operators/binding-closure.t
 S03-operators/binding-hashes.t
 S03-operators/binding-scalars.t



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About