Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of Array.elems #519

Closed
p6rt opened this issue Dec 22, 2008 · 7 comments
Closed

Implementation of Array.elems #519

p6rt opened this issue Dec 22, 2008 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 22, 2008

Migrated from rt.perl.org#61598 (status was 'rejected')

Searchable as RT61598$

@p6rt
Copy link
Author

p6rt commented Dec 22, 2008

From @bacek

Hello.

Trivial patch for Array.elems attached.

Quote from spectest​:

t/spec/S29-array/elems.rakudo (Wstat​: 0
Tests​: 12 Failed​: 0)
  TODO passed​: 11

--
Bacek

@p6rt
Copy link
Author

p6rt commented Dec 22, 2008

From @bacek

array_elems.patch
commit 72dd10b10602af5126441df0d266dccd353cb6c2
Author: Vasily Chekalkin <bacek@bacek.com>
Date:   Mon Dec 22 22:52:32 2008 +1100

    Implement Array.elems

diff --git a/languages/perl6/src/classes/Array.pir b/languages/perl6/src/classes/Array.pir
index f855fee..6037458 100644
--- a/languages/perl6/src/classes/Array.pir
+++ b/languages/perl6/src/classes/Array.pir
@@ -14,7 +14,7 @@ src/classes/Array.pir - Perl 6 Array class and related functions
     arrayproto.'!MUTABLE'()
 
     $P0 = get_hll_namespace ['Perl6Array']
-    '!EXPORT'('delete,exists,pop,push,shift,unshift', 'from'=>$P0)
+    '!EXPORT'('delete,elems,exists,pop,push,shift,unshift', 'from'=>$P0)
 .end
 
 =head2 Methods
@@ -59,6 +59,16 @@ Remove items from an array.
     .return (result)
 .end
 
+=item elems
+
+Return the number of elements in the array.
+
+=cut
+
+.sub 'elems' :method :multi(Perl6Array)
+    $I0 = self
+    .return ($I0)
+.end
 
 =item exists(indices :slurpy)
 

@p6rt
Copy link
Author

p6rt commented Dec 22, 2008

From @pmichaud

On Mon, Dec 22, 2008 at 04​:15​:20AM -0800, Vasily Chekalkin wrote​:

Trivial patch for Array.elems attached.

As far as I can tell, Array.elems already works in trunk without
the patch. Is there a specific test or set of tests this enables,
or a case that isn't being handled?

Pm

@p6rt
Copy link
Author

p6rt commented Dec 22, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 22, 2008

From @bacek

Patrick R. Michaud via RT wrote​:

On Mon, Dec 22, 2008 at 04​:15​:20AM -0800, Vasily Chekalkin wrote​:

Trivial patch for Array.elems attached.

As far as I can tell, Array.elems already works in trunk without
the patch. Is there a specific test or set of tests this enables,
or a case that isn't being handled?

This is from S29-array/elems.t

#?rakudo todo 'elems on Array ref'
{
  is (elems [1,2,3,4]), 4, "elems [1,2,3,4] should work";
}

It passed with patch, but I'm not sure that test is correct.

--
Bacek

@p6rt
Copy link
Author

p6rt commented Mar 10, 2009

From @pmichaud

Patch rejected; this will be better fixed when we have a settings-based
implementation of elems (which will be able to properly handle the binding).

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Mar 10, 2009

@pmichaud - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Mar 10, 2009
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant