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

Traps candidate? Sinkage of maps #1718

Closed
zoffixznet opened this issue Dec 20, 2017 · 7 comments
Closed

Traps candidate? Sinkage of maps #1718

zoffixznet opened this issue Dec 20, 2017 · 7 comments
Labels
docs Documentation issue (primary issue type) good first issue If you want to dive in, this would be a good place to start trap

Comments

@zoffixznet
Copy link
Contributor

Just mapping stuff in sink context may make people think it's perfectly fine to do it all the time:

m: <foo bar ber>.map: *.say
rakudo-moar 334b87226: OUTPUT: «foo␤bar␤ber␤»

However, if you nest another Seq inside (e.g. another map), that Seq just becomes an item inside the first Seq and so isn't sunk and the map isn't evaluated:

m: <foo bar ber>.map: *.say
rakudo-moar 334b87226: OUTPUT: «foo␤bar␤ber␤»
m: <foo bar ber>.map: *.comb.map: *.say
rakudo-moar 334b87226: OUTPUT: «»
@zoffixznet zoffixznet added the LHF label Dec 20, 2017
@coke coke added the docs Documentation issue (primary issue type) label Jan 17, 2018
@coke coke added good first issue If you want to dive in, this would be a good place to start and removed LHF labels Apr 9, 2018
@JJ
Copy link
Contributor

JJ commented May 2, 2018

See also #732 #1309 In general, sinking needs a better documentation.

@JJ JJ added the JJ TPF Grant label May 2, 2018
@JJ JJ removed the JJ TPF Grant label May 14, 2018
@JJ JJ closed this as completed in adc5f09 May 18, 2018
@AlexDaniel
Copy link
Member

I think adc5f09 doesn't explain why it happens.

@AlexDaniel AlexDaniel reopened this May 18, 2018
@JJ
Copy link
Contributor

JJ commented May 18, 2018

In this case, I'm not 100% it's an effect of sinkage. In fact, say returns True. You would be sinking a list of Trues in the first case, and the same would apply to the second case. If you take a single element of the innermost map and sink it, it will still output something. Expected result here would be printing of the letters of every element, and a list of lists of Trues that is sunk.

@JJ
Copy link
Contributor

JJ commented May 18, 2018

@AlexDaniel you caught me writing the explanation above. I really don't know why it happens. I have avoided referring to sink and included a workaround. That's good enough for the trap documentation, at least for me. If you've got a better theory, just let me know...

@JJ JJ closed this as completed in 455ea24 May 19, 2018
@JJ
Copy link
Contributor

JJ commented May 19, 2018

I have posted this in StackOverflow to clarify what's going on in the "normal" case, which I think it shouldn't work.

@AlexDaniel
Copy link
Member

The answers on StackOverflow are nice, the current documentation is not. Reopening :)

@AlexDaniel AlexDaniel reopened this May 19, 2018
@JJ
Copy link
Contributor

JJ commented May 19, 2018

That's precisely why I've asked that and linked the question...

@JJ JJ closed this as completed in a034aa8 May 19, 2018
Kaiepi pushed a commit to Kaiepi/doc that referenced this issue May 22, 2018
This closes Raku#1718 but see my comment.
Kaiepi pushed a commit to Kaiepi/doc that referenced this issue May 22, 2018
Kaiepi pushed a commit to Kaiepi/doc that referenced this issue May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue (primary issue type) good first issue If you want to dive in, this would be a good place to start trap
Projects
None yet
Development

No branches or pull requests

4 participants