Module with functions for sets

Share your advanced PureBasic knowledge/code with the community.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.74, 2018-12-07

The following functions are now about 2-3 times as fast as before:
  • First/NextPartitionK()
  • First/NextPartitionT()
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.75, 2018-12-27

License changed from Public Domain to MIT License.
Many thanks to Sicro for helpful advice!
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.76, 2019-08-11

Fixed:
  • internal sorting function did not work when using #PB_Sort_NoCase
Changed:
  • internal sorting function simplified and made faster
  • cosmetic and other minor changes
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.77, 2019-10-27

Changed
  • Renamed public function FromArrayS() to FromArray()
  • Renamed public function PartitionToStringList() to PartitionToList()
  • Small internal changes
  • Added some comments
  • Demo code improved
New
  • Public function IsSet()
  • Public function IsDisjoint()
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.78, 2021-03-08

Changed
  • Small internal changes
  • Added/changed some comments
New
  • Public function Product():
    generates the Cartesian product of two or or more sets
  • Demo program for calculating possible coalitions in a parliament
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.80, 2021-03-27

Changed
  • Changed order of parameters in functions FromString(), FromList(), FromArray(), FromArrayI(), PartitionFromString(), FromPartition().
    When calling these functions from old code, you'll get an appropriate error message. I'm sorry for any inconveniences.
  • Improved function Product().
  • Improved error checking in functions Union(), Intersection(), Difference(), SymmetricDifference().
  • Improved demo program "set_demo_coalitions.pb".
  • Improved some comments.
  • Some cosmetic changes.
New
  • Function Create(), for conveniently creating a set of consecutive whole numbers.
  • Demo program "set_demo_product.pb".
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Module with functions for sets

Post by Little John »

New version 1.81, 2021-03-28

Fixed
  • Bug in function NextPartitionK() that could cause a crash
Post Reply