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

Explanation of the "Single Arg Rule" #600

Closed
zoffixznet opened this issue Jun 16, 2016 · 8 comments
Closed

Explanation of the "Single Arg Rule" #600

zoffixznet opened this issue Jun 16, 2016 · 8 comments
Assignees
Labels
docs Documentation issue (primary issue type)

Comments

@zoffixznet
Copy link
Contributor

It either needs to be documented, or if it is, indexed/made indexable by search engines.

@zoffixznet zoffixznet added the docs Documentation issue (primary issue type) label Jun 16, 2016
@pmichaud
Copy link
Collaborator

I know I've been out of many recent conversations, but what is meant by "Single Arg Rule" here? Can you point to an example or discussion thread?

@zoffixznet
Copy link
Contributor Author

The stuff where you put a comma after a single thing to make it do what you intend. That's what I heard it referred to as, but I don't know all the details of it, which is why I was trying to find the docs.

<Zoffix> m: my @list = (1,),; dd @list
<camelia> rakudo-moar 2126ed: OUTPUT«Array @list = [(1,),]␤»
<Zoffix> m: my @list = (1),; dd @list
<camelia> rakudo-moar 2126ed: OUTPUT«Array @list = [1]␤»
<Zoffix> m: my @list = (1); dd @list
<camelia> rakudo-moar 2126ed: OUTPUT«Array @list = [1]␤»
<Zoffix> m: my @list = 1,; dd @list
<camelia> rakudo-moar 2126ed: OUTPUT«Array @list = [1]␤»
<Zoffix> m: my $list = 1,; dd $list
<camelia> rakudo-moar 2126ed: OUTPUT«Int $list = 1␤»
<Zoffix> m: my $list = (1,); dd $list
<camelia> rakudo-moar 2126ed: OUTPUT«List $list = $(1,)␤»
<Zoffix> m: my $list = (1,),; dd $list
<camelia> rakudo-moar 2126ed: OUTPUT«List $list = $(1,)␤»

@stmuk
Copy link
Contributor

stmuk commented Jun 16, 2016

I tried to explain this (probably not very well) in

https://perl6advent.wordpress.com/2015/12/14/day-15-2015-the-year-of-the-great-list-refactor/

Also there are details in S07 I think

S

On 17 June 2016 at 00:25, Zoffix Znet notifications@github.com wrote:

The stuff where you put a comma after a single thing to make it do what
you intend. That's what I heard it referred to as, but I don't know all the
details of it, which is why I was trying to find the docs.

m: my @list = (1,),; dd @list rakudo-moar 2126ed: OUTPUT«Array @list = [(1,),]␤» m: my @list = (1),; dd @list rakudo-moar 2126ed: OUTPUT«Array @list = [1]␤» m: my @list = (1); dd @list rakudo-moar 2126ed: OUTPUT«Array @list = [1]␤» m: my @list = 1,; dd @list rakudo-moar 2126ed: OUTPUT«Array @list = [1]␤» m: my $list = 1,; dd $list rakudo-moar 2126ed: OUTPUT«Int $list = 1␤» m: my $list = (1,); dd $list rakudo-moar 2126ed: OUTPUT«List $list = $(1,)␤» m: my $list = (1,),; dd $list rakudo-moar 2126ed: OUTPUT«List $list = $(1,)␤»


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#600 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AEUuY2gd2K59EXR8S1_TujP1Xi7VhM7qks5qMdt9gaJpZM4I34Gh
.

4096R/EA75174B Steve Mynott steve.mynott@gmail.com

@zoffixznet
Copy link
Contributor Author

@JJ
Copy link
Contributor

JJ commented Mar 15, 2018

Where should this go then? List?

@AlexDaniel
Copy link
Member

@JJ JJ closed this as completed in d1c19d5 Apr 17, 2018
@JJ
Copy link
Contributor

JJ commented Apr 18, 2018

Reopened to address @AlexDaniel concerns.

@JJ
Copy link
Contributor

JJ commented Mar 18, 2020

Reopening this because #3268

JJ added a commit that referenced this issue Aug 10, 2020
Deletes a confusing explanation based on iterators refs #3268 and adds an example to clarify also #600
@JJ JJ closed this as completed in df50cbd Aug 10, 2020
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)
Projects
None yet
Development

No branches or pull requests

5 participants