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

Using take on a listy expression doesn't take each element of that list #4320

Closed
p6rt opened this issue Jun 13, 2015 · 5 comments
Closed

Using take on a listy expression doesn't take each element of that list #4320

p6rt opened this issue Jun 13, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 13, 2015

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

Searchable as RT125401$

@p6rt
Copy link
Author

p6rt commented Jun 13, 2015

From @hoelzro

See the attached test file; for example​:

  my @​result = gather { take 'foo=bar'.split('=') };

results in an empty array, when it should result in an array with 'foo' and 'bar' as its contents.

@p6rt
Copy link
Author

p6rt commented Jun 13, 2015

From @hoelzro

test.p6

@p6rt
Copy link
Author

p6rt commented Oct 24, 2015

From @usev6

This now fails with X​::Seq​::Consumed​:

$ perl6-m -e 'my @​result = gather { take "foo=bar".split("=") }; say @​result'
This Seq has already been iterated, and its values consumed
  in block <unit> at -e​:1

Adding a 'flat' gives the expected result, though​:

$ perl6-m -e 'my @​result = flat gather { take "foo=bar".split("=") }; say @​result.perl'
["foo", "bar"]

$ perl6-m -e 'my @​result = gather { take "foo=bar".split("=") }.flat; say @​result.perl'
["foo", "bar"]

Since this behaviour looks good to me, I added a test to S04-statements/gather.t with commit Raku/roast@de87d7958b. Also, I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 24, 2015

From @usev6

This now fails with X​::Seq​::Consumed​:

$ perl6-m -e 'my @​result = gather { take "foo=bar".split("=") }; say @​result'
This Seq has already been iterated, and its values consumed
  in block <unit> at -e​:1

Adding a 'flat' gives the expected result, though​:

$ perl6-m -e 'my @​result = flat gather { take "foo=bar".split("=") }; say @​result.perl'
["foo", "bar"]

$ perl6-m -e 'my @​result = gather { take "foo=bar".split("=") }.flat; say @​result.perl'
["foo", "bar"]

Since this behaviour looks good to me, I added a test to S04-statements/gather.t with commit Raku/roast@de87d7958b. Also, I'm closing this ticket as 'resolved'.

@p6rt p6rt closed this as completed Oct 24, 2015
@p6rt
Copy link
Author

p6rt commented Oct 24, 2015

@usev6 - Status changed from 'new' to 'resolved'

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

No branches or pull requests

1 participant