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

Oppositive semigroup #46

Open
wants to merge 4 commits into
base: constant-monoid
Choose a base branch
from
Open

Conversation

marcosh
Copy link
Owner

@marcosh marcosh commented Sep 27, 2023

  • introduce opposite semigroup
  • do not flip arguments in list concatenation monoid

@@ -29,6 +29,6 @@ public function mempty(): array
*/
public function append($a, $b)
{
return array_merge($b, $a);
return array_merge($a, $b);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional ?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it is. I'll write an ADR for this.

Keeping the arguments in the same order is just more natural.

Otherwise append(['a'], ['b']) would be ['b', 'a'], while it is more expected to be ['a', 'b'].

Do you agree?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely ! Thanks for the explanation :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants