mohitanand001 / underscore_cpp

underscore_cpp
MIT License
7 stars 30 forks source link

first stab at improving set_union #25

Closed WizardOfArc closed 6 years ago

WizardOfArc commented 6 years ago

feedback is very welcome.

I'm thinking that instead of making the variadic case recursive, we could put each of the provided collections in a vector and do something around that... although keeping track of which collection had the minimum value in order to advance might be too much calculation 🤔

mohitanand001 commented 6 years ago

Meanwhile, I'll look into what can be done with the varidac implementation.

WizardOfArc commented 6 years ago

one idea for doing union of variadic parameter of sets is to:

  1. turn that into a vector of Collections (sets)
  2. for each set in vector - sort them
  3. declare a max_seen_so_far (auto?)
  4. declare a vector of the above type (not sure how)
  5. while at least one of the sets is non empty
  6. take the first element of each and add to vector
  7. sort this vector
  8. for each element of this vector check if element == to max_seen_so_far
  9. if not, add to result and update max_seen_so_far accordingly
  10. clear vector
  11. do again with next element of each vector
WizardOfArc commented 6 years ago

@farziengineer sorry I didn't see the hpp file the first time around... I noticed that the signature in the .hpp file for max and min does not have const in it, but the .cpp file does. I'm making my change accordingly.... I also noticed that the header file does not have declarations for intersect and union of arity 2 - does that need to be in there?

mohitanand001 commented 6 years ago

No problem 🙂. Actually you are right, some function declaration are not there in .hpp files.#12

mohitanand001 commented 6 years ago

Hi please configure your email and username locally, otherwise your contributions won't be shown.

WizardOfArc commented 6 years ago

@farziengineer how do I do that? Set the config locally and then push again?

mohitanand001 commented 6 years ago

I do not think this would be a good idea. You can configure it now and your future commits would be shown on the profile. You can also search on Google if there is some workaround.

WizardOfArc commented 6 years ago

My friend helped me add my other committing email to my github account - so now it should be fine 😸