Recent

Author Topic: Large or huge sets  (Read 1109 times)

PascalDragon

  • Hero Member
  • *****
  • Posts: 726
  • Compiler Developer
Re: Large or huge sets
« Reply #15 on: September 11, 2019, 09:41:36 am »
Large or huge sets are often requested. Just today I needed one. Wrote it in ten minutes, but maybe useful?
If the critics are not too harsh, I will add it to to the wiki.
Note it can be written *way* more efficient.
Small remark: due to the use of global operators they can't be used inside generics (at least as of now) while normal sets have no problem with that.

Thaddy

  • Hero Member
  • *****
  • Posts: 9293
Re: Large or huge sets
« Reply #16 on: September 11, 2019, 09:50:31 am »
Large or huge sets are often requested. Just today I needed one. Wrote it in ten minutes, but maybe useful?
If the critics are not too harsh, I will add it to to the wiki.
Note it can be written *way* more efficient.
Small remark: due to the use of global operators they can't be used inside generics (at least as of now) while normal sets have no problem with that.
I know. It is not perfect in any way, but it works.... :-X and the code is reasonably clean and not bloat as was suggested.
I was able to use this in re-examining my translation of the Delphi Gold parser system.
« Last Edit: September 11, 2019, 09:54:54 am by Thaddy »
also related to equus asinus.

avk

  • Full Member
  • ***
  • Posts: 167
    • my self-education project
Re: Large or huge sets
« Reply #17 on: September 13, 2019, 08:48:31 pm »
@Thaddy, but why exactly TSortedHashSet?

Thaddy

  • Hero Member
  • *****
  • Posts: 9293
Re: Large or huge sets
« Reply #18 on: September 13, 2019, 09:35:35 pm »
Because it has a distinctive "set" of advantages  :D
It is reasonably fast, is sorted (essential) and does not accept duplicates. It behaves like normal, basic, Pascal sets. (But I wrote it is in no way optimal, it is also not bloat as suggested - that one is fired if he was working for me)

The approach was to have large sets with as few lines of code possible and it should match normal set behavior. Job done. And really in 10 minutes. I like simple code for complex problems....
also related to equus asinus.