-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hi, I came across this implementation of yours from here
Amazing article! For my understanding, I decided to write it in Clojure but fumbled upon one aspect of concat
A multiset can have repetitive keys
[('cat', 4), ('dog', 2), ('elephant', -4), ('elephant', 4)]
When implementing concat, how do I decide which keys to merge it against? For e.g.
[('cat', 4), ('dog', 2), ('elephant', -4), ('elephant', 4)].concat([('elephant', 1)])
has 3 possibilities
#1 [('cat', 4), ('dog', 2), ('elephant', -3), ('elephant', 4)]
#2 [('cat', 4), ('dog', 2), ('elephant', -4), ('elephant', 5)]
#3 [('cat', 4), ('dog', 2), ('elephant', -4), ('elephant', 4), ('elephant', 1)]
Now, I know it doesn't matter since consolidating them results in the same outcome, so what would be my basis to make a choice?
Metadata
Metadata
Assignees
Labels
No labels