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

map accepts lambda-param spillover, for doesn't -- inconsistency in Rakudo? #1093

Closed
p6rt opened this issue Jun 23, 2009 · 5 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 23, 2009

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

Searchable as RT66890$

@p6rt
Copy link
Author

p6rt commented Jun 23, 2009

From @masak

<masak> rakudo​: say (map -> $a, $b { $a }, 1..5).perl; for 1..5 -> $a,
$b {} [12​:05]
<p6eval> rakudo 10f223​: OUTPUT«[1, 3]␤StopIteration␤in Main
(/tmp/2qZBAsxsOE​:2)␤»
* masak submits rakudobug

I'd like to take this opportunity to express my strong dislike for the
'StopIteration' error. I'd much rather see the for loops siltently
drop values (as map seems to do above), than map emulating the
irritating behaviour of for. But I guess it's ultimately a question
for p6l.

@p6rt
Copy link
Author

p6rt commented Oct 3, 2009

From @masak

On Tue Jun 23 03​:12​:32 2009, masak wrote​:

<masak> rakudo​: say (map -> $a, $b { $a }, 1..5).perl; for 1..5 -> $a,
$b {} [12​:05]
<p6eval> rakudo 10f223​: OUTPUT«[1, 3]␤StopIteration␤in Main
(/tmp/2qZBAsxsOE​:2)␤»
* masak submits rakudobug

I'd like to take this opportunity to express my strong dislike for the
'StopIteration' error. I'd much rather see the for loops siltently
drop values (as map seems to do above), than map emulating the
irritating behaviour of for. But I guess it's ultimately a question
for p6l.

Here's yet another difference between map and for​:

<masak> rakudo​: for 1,2,3 -> $a, $b = $a { say $b }
<p6eval> rakudo e976f2​: OUTPUT«2␤StopIteration␤in Main (/tmp/5WCiLsPJDY​:0)␤»
<masak> rakudo​: map -> $a, $b = $a { say $b }, 1, 2, 3
<p6eval> rakudo e976f2​: OUTPUT«1␤2␤3␤»

Again, I like map's behaviour much better.

@p6rt
Copy link
Author

p6rt commented Oct 3, 2009

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Feb 23, 2011

From @moritz

Both behave the same now, (printing 2\n3\n), because for is implemented
in terms of map.

@p6rt
Copy link
Author

p6rt commented Feb 23, 2011

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

@p6rt p6rt closed this as completed Feb 23, 2011
@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