Skip to content

Oppositive semigroup#46

Open
marcosh wants to merge 4 commits into
constant-monoidfrom
oppositive-semigroup
Open

Oppositive semigroup#46
marcosh wants to merge 4 commits into
constant-monoidfrom
oppositive-semigroup

Conversation

@marcosh

@marcosh marcosh commented Sep 27, 2023

Copy link
Copy Markdown
Owner
  • introduce opposite semigroup
  • do not flip arguments in list concatenation monoid

public function append($a, $b)
{
return array_merge($b, $a);
return array_merge($a, $b);

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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