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

Hash slice with structured list does not come out structured / adverbs do not work #6418

Open
p6rt opened this issue Aug 1, 2017 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Aug 1, 2017

Migrated from rt.perl.org#131826 (status was 'open')

Searchable as RT131826$

@p6rt
Copy link
Author

p6rt commented Aug 1, 2017

From @zoffixznet

If you give a structured list as an Array slice, you get structured data back​:

  my @​a = 'a'..'z';
  dd @​a[(1, 2, 3), (5, (6, 7), (8, 9))];
  # OUTPUT​: (("b", "c", "d"), ("f", ("g", "h"), ("i", "j")))

But if you give the same type of structured list to a hash slice, you get flat data back​:
  my %a = 'a'..'z';
  dd %a{<a c e>, (<g i k>, ('m', ('o')))};
  # OUTPUT​: ("b", "d", "f", "h", "j", "l", "n", "p")

I'd expect the hash slice to be equally structured and give this back​:

  # OUTPUT​: (("b", "d", "f"), (("h", "j", "l"), ("n", ("p"))))

@p6rt
Copy link
Author

p6rt commented Aug 1, 2017

From @zoffixznet

Turns out the rabbit hole goes deeper. Adverbs appear to not work if slice is structured​:

  my %a = 'a'..'z';
  dd %a{<a c e>, (<g i k>, ('m', ('o')))}​:kv; # OUTPUT​: ()
  %a{<a c e>, (<g i k>, ('m', ('o')))}​:delete;
  dd +%a.keys; # OUTPUT​: 13

Shouldn't it give structured `kv` data back and delete at least some keys?

@p6rt
Copy link
Author

p6rt commented Aug 1, 2017

From @lizmat

On 1 Aug 2017, at 14​:36, Zoffix Znet via RT <perl6-bugs-followup@​perl.org> wrote​:

Turns out the rabbit hole goes deeper. Adverbs appear to not work if slice is structured​:

my %a = 'a'..'z';
dd %a{<a c e>, (<g i k>, ('m', ('o')))}​:kv; # OUTPUT​: ()
%a{<a c e>, (<g i k>, ('m', ('o')))}​:delete;
dd +%a.keys; # OUTPUT​: 13

Shouldn't it give structured `kv` data back and delete at least some keys?

I wonder whether we shouldn’t make all of the slicing lazy. So instead of returning a reified List, it would return a Seq.

@p6rt
Copy link
Author

p6rt commented Aug 1, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant