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

[svn:parrot] r34316 - in trunk/languages/perl6/src: builtins classes

From:
pmichaud
Date:
December 23, 2008 23:05
Subject:
[svn:parrot] r34316 - in trunk/languages/perl6/src: builtins classes
Message ID:
20081224070527.99C3ACBA12@x12.develooper.com
Author: pmichaud
Date: Tue Dec 23 23:05:26 2008
New Revision: 34316

Modified:
   trunk/languages/perl6/src/builtins/any-list.pir
   trunk/languages/perl6/src/classes/List.pir

Log:
[rakudo]:  List methods are already in Any, no need to have them in List also.


Modified: trunk/languages/perl6/src/builtins/any-list.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/any-list.pir	(original)
+++ trunk/languages/perl6/src/builtins/any-list.pir	Tue Dec 23 23:05:26 2008
@@ -168,7 +168,7 @@
 .namespace ['Any']
 .sub 'keys' :method
     $I0 = self.'elems'()
-    $P0 = 'infix:^'($I0)
+    $P0 = 'prefix:^'($I0)
     .tailcall $P0.'list'()
 .end
 

Modified: trunk/languages/perl6/src/classes/List.pir
==============================================================================
--- trunk/languages/perl6/src/classes/List.pir	(original)
+++ trunk/languages/perl6/src/classes/List.pir	Tue Dec 23 23:05:26 2008
@@ -15,8 +15,6 @@
     p6meta.'add_role'($P0, 'to'=>listproto)
     p6meta.'register'('ResizablePMCArray', 'parent'=>listproto, 'protoobject'=>listproto)
 
-    $P0 = get_hll_namespace ['List']
-    '!EXPORT'('keys,kv,pairs,values', $P0)
 .end
 
 =head2 Methods
@@ -349,83 +347,6 @@
 .end
 
 
-=item keys()
-
-Returns a List containing the keys of the invocant.
-
-=cut
-
-.sub 'keys' :method :multi(ResizablePMCArray)
-    $I0 = self.'elems'()
-    dec $I0
-    $P0 = 'infix:..'(0, $I0)
-    .tailcall $P0.'list'()
-.end
-
-.sub 'keys' :multi()
-    .param pmc values          :slurpy
-    .tailcall values.'keys'()
-.end
-
-
-=item kv()
-
-Return items in invocant as 2-element (index, value) lists.
-
-=cut
-
-.sub 'kv' :method :multi(ResizablePMCArray)
-    .local pmc result, iter
-    .local int i
-
-    result = new 'List'
-    iter = self.'iterator'()
-    i = 0
-  iter_loop:
-    unless iter goto iter_end
-    $P0 = shift iter
-    push result, i
-    push result, $P0
-    inc i
-    goto iter_loop
-  iter_end:
-    .return (result)
-.end
-
-.sub 'kv' :multi()
-    .param pmc values          :slurpy
-    .tailcall values.'kv'()
-.end
-
-=item pairs()
-
-Return a list of Pair(index, value) elements for the invocant.
-
-=cut
-
-.sub 'pairs' :method :multi(ResizablePMCArray)
-    .local pmc result, iter
-    .local int i
-
-    result = new 'List'
-    iter = self.'iterator'()
-    i = 0
-  iter_loop:
-    unless iter goto iter_end
-    $P0 = shift iter
-    $P1 = 'infix:=>'(i, $P0)
-    push result, $P1
-    inc i
-    goto iter_loop
-  iter_end:
-    .return (result)
-.end
-
-.sub 'pairs' :multi()
-    .param pmc values          :slurpy
-    .tailcall values.'pairs'()
-.end
-
 =item uniq(...)
 
 =cut
@@ -481,25 +402,6 @@
 .end
 
 
-.namespace ['List']
-
-=item values()
-
-Returns a List containing the values of the invocant.
-
-=cut
-
-.sub 'values' :method :multi('ResizablePMCArray')
-    self.'!flatten'()
-    .return (self)
-.end
-
-.sub 'values' :multi()
-    .param pmc values          :slurpy
-    .tailcall values.'!flatten'()
-.end
-
-
 =back
 
 =head1 Functions



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