Navigation Menu

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

take accepts only one argument #1839

Closed
p6rt opened this issue Jun 16, 2010 · 5 comments
Closed

take accepts only one argument #1839

p6rt opened this issue Jun 16, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 16, 2010

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

Searchable as RT75794$

@p6rt
Copy link
Author

p6rt commented Jun 16, 2010

From @cognominal

[11​:46​:54] <cognominal> is there a reason why take accepts only one argument?
[11​:48​:08] <moritz_> not really
[11​:48​:15] <Tene> I expect that the behavior of what that would mean
isn't specified.
[11​:48​:16] <moritz_> it should take a raw capture, and pass that on
[11​:48​:26] <Tene> Sounds reasonable.
[11​:50​:22] <pmichaud> > say gather for 1 { take (1,2,3) }
[11​:50​:22] <pmichaud> 123
[11​:50​:32] <moritz_> that's not the same
[11​:50​:42] <moritz_> take (1, 2, 3) vs take 1, 2, 3
[11​:50​:46] <pmichaud> yes, I know.
[11​:51​:04] <pmichaud> take should have the same signature as return
[11​:51​:40] <cognominal> should I masak that? I mean, file a bug?
[11​:52​:01] <moritz_> yes, please
[11​:52​:38] <pmichaud> src/builtins/control.pir, line 220
[11​:52​:46] <pmichaud> .param pmc value
[11​:52​:48] <pmichaud> should be
[11​:52​:53] <pmichaud> .param pmc value :slurpy
[11​:53​:50] <pmichaud> and then do the same processing as in &return above
[11​:54​:28] <pmichaud> in many ways, both &return and &take are the
same, what differs is the type of exception thrown.

http://irclog.perlgeek.de/perl6/2010-06-16#i_2443346 for the whole discussion.

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

From @pmichaud

This appears to have been fixed in 43c38f6f (moritz++) -- assigning
ticket to moritz for spectest verification.

Pm

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

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

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S04-statements/gather.t

commit 98425f05d0427d9d78592a75a18b00039bdabc9f
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Tue Jun 29 10​:27​:54 2010 +0000

  [t/spec] test for RT #​75794 - take() with multiple arguments
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31498 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S04-statements/gather.t b/t/spec/S04-statements/gather.t
index 298ddd7..77da1e7 100644
--- a/t/spec/S04-statements/gather.t
+++ b/t/spec/S04-statements/gather.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 14;
+plan 16;
 
 
 # L<S04/The C<gather> statement prefix/>
@@ -135,4 +135,13 @@ plan 14;
     is ~@list, "2 4 6 8 10", "gather with nested loop";
 }
 
+{
+    is (gather { take 1, 2, 3; take 4, 5, 6; }).elems, 2,
+        'take with multiple arguments produces one item each';
+
+    is (gather { take 1, 2, 3; take 4, 5, 6; }).flat.elems, 6,
+        'take with multiple arguments .flat tens out';
+}
+
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

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

@p6rt p6rt closed this as completed Jun 29, 2010
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