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

“Identity element” section with an explanation and a table of Raku ops #2129

Open
AlexDaniel opened this issue Jun 27, 2018 · 5 comments
Labels
docs Documentation issue (primary issue type) new part of "docs" - indicates that this documentation is for a new, currently undoc'd section

Comments

@AlexDaniel
Copy link
Member

AlexDaniel commented Jun 27, 2018

See https://en.wikipedia.org/wiki/Identity_element.

I think this should be discussed in Perl 6 docs (not just linked to wikipedia). We can have a similar table that specifically lists perl 6 ops.

For example, identity element for ~ is an empty string (""), even though ~ can be used for Blobs. There's a separate trap for that particular detail (see #2124), but it should be discussed in main docs also in context of identity elements (or maybe reduction).

@JJ
Copy link
Contributor

JJ commented Jun 27, 2018 via email

@JJ JJ added docs Documentation issue (primary issue type) new part of "docs" - indicates that this documentation is for a new, currently undoc'd section labels Jun 27, 2018
@JJ
Copy link
Contributor

JJ commented Sep 15, 2018

There are 71 messages in the thread about identity operators: https://groups.google.com/forum/#!topic/perl.perl6.language/YIWdmJ54buw
I'm checking out the source, and it's almost impossible to find out which are the identity operators unless you go source by source. Let me see if I can find a compromise, at least with some operators.

JJ added a commit that referenced this issue Sep 15, 2018
Which refs #2129. Missing is a link from where this is used.
@JJ JJ closed this as completed in 603a7fb Sep 15, 2018
@AlexDaniel
Copy link
Member Author

AlexDaniel commented Sep 15, 2018

I don't like the table as it is confusing and doesn't answer the question for some ops.

For example, what about × (multiplication)? It says 0 for “Arithmetic” but the identity for × is 1.

What about //? Or ? And so on.

I think the table should list all operators, maybe group them if you like. I don't think there's necessarily a need to check the source code as you can just do say […] and it'll give you the identity op in most cases. Also we should probably have a test file in roast that checks identities of all ops (if we don't have it already, please create it).

@AlexDaniel AlexDaniel reopened this Sep 15, 2018
@mykhal
Copy link
Contributor

mykhal commented Jul 23, 2021

At its current state, the section is quite informative.

For now, I see a couple of issues in the table:

  • Bool::True for Equality should probably be just True, for consistency
  • junctions are not mentioned, [&], [|], [^] # => (all(), any(), one())

.. as @AlexDaniel mentioned, e.g. [o] has also interesting result.

@coke coke changed the title “Identity element” section with an explanation and a table of perl 6 ops “Identity element” section with an explanation and a table of Raku ops Nov 14, 2022
@coke
Copy link
Collaborator

coke commented Nov 14, 2022

Updated the Bool::True item - Someone needs to verify that the junction and o items are spec or "only" rakudo's implementation.

coke added a commit that referenced this issue Nov 14, 2022
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) new part of "docs" - indicates that this documentation is for a new, currently undoc'd section
Projects
None yet
Development

No branches or pull requests

4 participants