# FreeBSD Manual Pages

Set::Infinite::Basic(3User Contributed Perl DocumentatiSet::Infinite::Basic(3)NAMESet::Infinite::Basic - Sets of intervals 6 =head1 SYNOPSIS use Set::Infinite::Basic; $set = Set::Infinite::Basic->new(1,2); # [1..2] print $set->union(5,6); # [1..2],[5..6]DESCRIPTIONSet::Infinite::Basic is a Set Theory module for infinite sets. It works on reals, integers, and objects. This module does not support recurrences. Recurrences are implemented in Set::Infinite.METHODSempty_setCreates an empty_set. If called from an existing set, the empty set inherits the "type" and "density" characteristics.universal_setCreates a set containing "all" possible elements. If called from an existing set, the universal set inherits the "type" and "density" characteristics.untilExtends a set until another: 0,5,7 -> until 2,6,10 gives [0..2), [5..6), [7..10) Note: this function is still experimental.copycloneMakes a new object from the object's data.Modefunctions:$set = $set->real; $set = $set->integer;Logicfunctions:$logic = $set->intersects($b); $logic = $set->contains($b); $logic = $set->is_null; # also called "is_empty"Setfunctions:$set = $set->union($b); $set = $set->intersection($b); $set = $set->complement; $set = $set->complement($b); # can also be called "minus" or "difference" $set = $set->symmetric_difference( $b ); $set = $set->span; result is (min .. max)Scalarfunctions:$i = $set->min; $i = $set->max; $i = $set->size; $i = $set->count; # number of spansOverloadedPerlfunctions:print sort, <=>Globalfunctions:separators(@i) chooses the interval separators. default are [ ] ( ) '..' ','. INFINITY returns an 'Infinity' number. NEG_INFINITY returns a '-Infinity' number. iterate ( sub { } ) Iterates over a subroutine. Returns the union of partial results. first In scalar context returns the first interval of a set. In list context returns the first interval of a set, and the 'tail'. Works in unbounded sets type($i) chooses an object data type. default is none (a normal perl SCALAR). examples: type('Math::BigFloat'); type('Math::BigInt'); type('Set::Infinite::Date'); See notes on Set::Infinite::Date below. tolerance(0) defaults to real sets (default) tolerance(1) defaults to integer sets real defaults to real sets (default) integer defaults to integer setsInternalfunctions:$set->fixtype; $set->numeric;CAVEATS$set = Set::Infinite->new(10,1); Will be interpreted as [1..10] $set = Set::Infinite->new(1,2,3,4); Will be interpreted as [1..2],[3..4] instead of [1,2,3,4]. You probably want ->new([1],[2],[3],[4]) instead, or maybe ->new(1,4) $set = Set::Infinite->new(1..3); Will be interpreted as [1..2],3 instead of [1,2,3]. You probably want ->new(1,3) instead.INTERNALSThe internal representation of aspanis a hash: { a => start of span, b => end of span, open_begin => '0' the span starts in 'a' '1' the span starts after 'a' open_end => '0' the span ends in 'b' '1' the span ends before 'b' } For example, this set: [100..200),300,(400..infinity) is represented by the array of hashes: list => [ { a => 100, b => 200, open_begin => 0, open_end => 1 }, { a => 300, b => 300, open_begin => 0, open_end => 0 }, { a => 400, b => infinity, open_begin => 0, open_end => 1 }, ] Thedensityof a set is stored in the "tolerance" variable: tolerance => 0; # the set is made of real numbers. tolerance => 1; # the set is made of integers. The "type" variable stores theclassof objects that will be stored in the set. type => 'DateTime'; # this is a set of DateTime objects Theinfinityvalue is generated by Perl, when it finds a numerical overflow: $inf = 100**100**100;SEE ALSOSet::InfiniteAUTHORFlavio S. Glock <fglock@gmail.com> perl v5.32.1 2010-04-26 Set::Infinite::Basic(3)

NAME | DESCRIPTION | METHODS | CAVEATS | INTERNALS | SEE ALSO | AUTHOR

Want to link to this manual page? Use this URL:

<https://www.freebsd.org/cgi/man.cgi?query=Set::Infinite::Basic&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>