-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add collections.Complement #5400
Comments
What does that do? Complement of a set A is all elements that are not in set A, but are in the universe set U. So if I hope that the A complement needs just two arguments.. (1) the set being complemented (A), and (2) the universe set (U). But your example shows that Further reading: https://en.wikipedia.org/wiki/Complement_(set_theory) Update: Fix typo: union -> universe |
A complement function needs at least one argument to make some sense. But the signature and definition for "Hugo's complement" matches Wolfram's. |
You meant at least two arguments, right? From Wolfram's complement signature, eall is the U set I mentioned above, and e1 is the A set in my example. So what I asked above:
holds true? May be for clarity, you write the example code as:
Correct? To match with Wolfram definition of
|
No, one (1). A slice that complements nothing would be unchanged. If we instead of CS set theory talk in practical examples:
Which also matches my sense of language: "give me the pages that complement the first 4 and the last 4". |
What's the use case of that? Why not require two arguments at the minimum? A "complement" is always with reference to something. So we need the thing being complemented, and the reference against which we are complementing that. Allowing only one arg to complement doesn't make sense to me. |
I assume that you agree that: {{ slice "a" "b" | complement slice }} Should result in "a" and "b". But what about: {{ slice "a" "b" | complement giveMeSomeSlices }} If |
I have adjusted it to fail on < 2 arguments, but it still makes sense to "complement nothing". |
I would interpret as:
So So the question is a Go-lang question.. is passing a nil (empty Go slice) argument the same as passing no argument? If so, I can understand why you put the requirement of at least 1 arg. |
No. Nil are also values, so you are correct in the "2 argument" argument, but I have been bitten by the "being too restrictive" in the validations we do in that template package. |
This is not being restrictive.. it's just the definition of "complement". Something can be complemented always with respect to some reference. There has to be always some reference. So your recent change (bep@20d85f9#diff-7abc0a71d95894310bb43c55be54d0e0R26) looks good. I don't care about the internal implementation. My earlier suggestion to break up the Complement args was just to get my point across that we need a Universe (U) set and then we need at aleast one other set that needs to be complemented out of that Universe. Thanks. Update: Fix typo: union -> universe |
All along I was saying "union", but I meant universe Ref: https://en.wikipedia.org/wiki/Complement_(set_theory)#Definition
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
http://www.wolframalpha.com/input/?i=wolfram+language+symbol+Complement&lk=1&assumption=%22ClashPrefs%22+-%3E+%7B%22WolframLanguageSymbol%22,+%22Complement%22%7D
complement
$pages = $pages | complement $pages1 $pages2
etc.The text was updated successfully, but these errors were encountered: