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

@a[*] does not work as slice of all indexes #2034

Closed
p6rt opened this issue Aug 7, 2010 · 8 comments
Closed

@a[*] does not work as slice of all indexes #2034

p6rt opened this issue Aug 7, 2010 · 8 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 7, 2010

Migrated from rt.perl.org#77072 (status was 'resolved')

Searchable as RT77072$

@p6rt
Copy link
Author

p6rt commented Aug 7, 2010

From sohtil@gmail.com

Hi!

In @​a[*], * should mean all indexes of @​a, but this does not work in
Rakudo, currently​:

#perl6 2010-08-07
14​:01 lithos hello #perl6! is @​a[*] supposed to work for
indexing the one-past-last element of an array?
14​:02 sorear no
14​:02 TimToady * means all the indexes
14​:03 TimToady so it should mean @​a[0,1,2] = 4
14​:03 lithos ah, thanks
14​:04 lithos rakudo​: my @​a = 1, 2, 3; @​a[*] = (4, 5, 6); say ~@​a;
14​:04 p6eval rakudo 6ebba8​: OUTPUT«Can't take numeric value for
object of type Whatever␤ in 'Any​::Numeric' at line 1351​:CORE.setting␤
in 'infix​:<<>' at line 6573​:CORE.setting␤ in 'Any​::postcircumfix​:<[
]>' at line 1665​:CORE.setting␤ in main program body at line 1␤»

$ ./perl6

my @​a = 1,2,3;
1 2 3
say ~@​a[0,1,2];
1 2 3
say ~@​a[*];
Can't take numeric value for object of type Whatever

$ ./perl6 --version

This is Rakudo Perl 6, version 2010.07-86-ge569d66 built on parrot 2.6.0 r48225

@p6rt
Copy link
Author

p6rt commented Aug 7, 2010

From radu_cs85@yahoo.com

Added test in S02-builtin_data_types/array.t

@p6rt
Copy link
Author

p6rt commented Aug 7, 2010

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

@p6rt
Copy link
Author

p6rt commented Aug 7, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/array.t

commit d0df7b06ecf59256f0520d23b54d073cb965050b
Author​: radus <radus@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Aug 7 17​:09​:30 2010 +0000

  [t/spec] added test for RT 77072 @​a[*] does not work as slice of all indexes
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31920 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-builtin_data_types/array.t b/t/spec/S02-builtin_data_types/array.t
index 6a7752d..57c5f38 100644
--- a/t/spec/S02-builtin_data_types/array.t
+++ b/t/spec/S02-builtin_data_types/array.t
@@ -340,6 +340,14 @@ my @array2 = ("test", 1, Mu);
     dies_ok { Mu.[0] }, 'but Mu has no .[]';
 }
 
+#RT #77072
+
+#?rakudo skip 'RT 77072 star not working for array indexing yet - code fails' 
+{
+    my @a = <1 2 3>;
+    is @a[*], <1 2 3> , 'using * to access all array elements works';
+}
+
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 7, 2010

From @pmichaud

Now fixed in fca2d3. There's already a spectest for the test, but I'm
unable to commit spectest changes at the moment so I'll leave the ticket
open for someone else to close.

I also fixed .{*} in this patch, it probably needs tests as well.

Pm

@p6rt
Copy link
Author

p6rt commented Aug 8, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/array.t

commit 84491e4d2d0e0edae629fdcaee3da248f047eb79
Author​: radus <radus@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Aug 8 09​:11​:30 2010 +0000

  [t/spec] Unfudged test for RT 77072 - @​a[*] works as expected now.
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31924 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S02-builtin_data_types/array.t b/t/spec/S02-builtin_data_types/array.t
index 57c5f38..e2fc2e8 100644
--- a/t/spec/S02-builtin_data_types/array.t
+++ b/t/spec/S02-builtin_data_types/array.t
@@ -342,7 +342,6 @@ my @array2 = ("test", 1, Mu);
 
 #RT #77072
 
-#?rakudo skip 'RT 77072 star not working for array indexing yet - code fails' 
 {
     my @a = <1 2 3>;
     is @a[*], <1 2 3> , 'using * to access all array elements works';

@p6rt
Copy link
Author

p6rt commented Aug 8, 2010

From @moritz

Hash zen slices now tested in t/spec/S02-builtin_data_types/hash.t.

@p6rt
Copy link
Author

p6rt commented Aug 8, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Aug 8, 2010
@p6rt p6rt added the Bug 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