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

Document aliases and illustrate with how to create :0th :1st :2nd :3rd :4th named thingies #1696

Closed
AlexDaniel opened this issue Dec 2, 2017 · 4 comments
Assignees
Labels
docs Documentation issue (primary issue type)

Comments

@AlexDaniel
Copy link
Member

AlexDaniel commented Dec 2, 2017

Is there a shorthand way for accepting numeric options and merging them so you can do :0th :1st :2nd :3rd fun?

sub ordinated( :st(:nd(:rd(:th($num))))=-1 ) {
    say "I got $num."
}
ordinated(:0th); # OUTPUT: «I got 0.␤»
ordinated(:1st); # OUTPUT: «I got 1.␤»
ordinated(:2nd); # OUTPUT: «I got 2.␤»
ordinated(:3rd); # OUTPUT: «I got 3.␤»
ordinated(:4th); # OUTPUT: «I got 4.␤»
ordinated();     # OUTPUT: «I got -1.␤»
@AlexDaniel AlexDaniel added the docs Documentation issue (primary issue type) label Dec 2, 2017
@treyharris treyharris self-assigned this Dec 2, 2017
@treyharris
Copy link
Contributor

I'll take this and increase its scope a bit since there appears to be no documentation of aliases at all, and this is a good example to illustrate.

@treyharris treyharris changed the title Document how to create :0th :1st :2nd :3rd :4th named thingies Document aliases and illustrate with how to create :0th :1st :2nd :3rd :4th named thingies Dec 2, 2017
@AlexDaniel
Copy link
Member Author

AlexDaniel commented Dec 2, 2017

Also:

@JJ
Copy link
Contributor

JJ commented Sep 16, 2018

Ping?

@JJ
Copy link
Contributor

JJ commented Mar 31, 2019

  • Argument aliases are documented now
  • That above is just a hack, which besides breaks if you simply use 1th. We can additionally document nested aliases.

JJ added a commit to JJ/my-raku-examples that referenced this issue Mar 31, 2019
JJ added a commit to JJ/my-raku-examples that referenced this issue Mar 31, 2019
JJ added a commit to JJ/my-raku-examples that referenced this issue Mar 31, 2019
@JJ JJ closed this as completed in 74f848c Mar 31, 2019
JJ added a commit that referenced this issue Mar 31, 2019
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

3 participants