.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05) .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Set::Infinite::Basic 3pm" .TH Set::Infinite::Basic 3pm "2008-07-21" "perl v5.10.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Set::Infinite::Basic \- Sets of intervals 6 =head1 SYNOPSIS .PP .Vb 1 \& use Set::Infinite::Basic; \& \& $set = Set::Infinite::Basic\->new(1,2); # [1..2] \& print $set\->union(5,6); # [1..2],[5..6] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Set::Infinite::Basic is a Set Theory module for infinite sets. .PP It works on reals, integers, and objects. .PP This module does not support recurrences. Recurrences are implemented in Set::Infinite. .SH "METHODS" .IX Header "METHODS" .Sh "empty_set" .IX Subsection "empty_set" Creates an empty_set. .PP If called from an existing set, the empty set inherits the \*(L"type\*(R" and \*(L"density\*(R" characteristics. .Sh "universal_set" .IX Subsection "universal_set" Creates a set containing \*(L"all\*(R" possible elements. .PP If called from an existing set, the universal set inherits the \*(L"type\*(R" and \*(L"density\*(R" characteristics. .Sh "until" .IX Subsection "until" Extends a set until another: .PP .Vb 1 \& 0,5,7 \-> until 2,6,10 .Ve .PP gives .PP .Vb 1 \& [0..2), [5..6), [7..10) .Ve .PP Note: this function is still experimental. .Sh "copy" .IX Subsection "copy" .Sh "clone" .IX Subsection "clone" Makes a new object from the object's data. .Sh "Mode functions:" .IX Subsection "Mode functions:" .Vb 1 \& $set = $set\->real; \& \& $set = $set\->integer; .Ve .Sh "Logic functions:" .IX Subsection "Logic functions:" .Vb 1 \& $logic = $set\->intersects($b); \& \& $logic = $set\->contains($b); \& \& $logic = $set\->is_null; # also called "is_empty" .Ve .Sh "Set functions:" .IX Subsection "Set functions:" .Vb 1 \& $set = $set\->union($b); \& \& $set = $set\->intersection($b); \& \& $set = $set\->complement; \& $set = $set\->complement($b); # can also be called "minus" or "difference" \& \& $set = $set\->simmetric_difference( $b ); \& \& $set = $set\->span; \& \& result is (min .. max) .Ve .Sh "Scalar functions:" .IX Subsection "Scalar functions:" .Vb 1 \& $i = $set\->min; \& \& $i = $set\->max; \& \& $i = $set\->size; \& \& $i = $set\->count; # number of spans .Ve .Sh "Overloaded Perl functions:" .IX Subsection "Overloaded Perl functions:" .Vb 1 \& print \& \& sort, <=> .Ve .Sh "Global functions:" .IX Subsection "Global functions:" .Vb 1 \& separators(@i) \& \& chooses the interval separators. \& \& default are [ ] ( ) \*(Aq..\*(Aq \*(Aq,\*(Aq. \& \& INFINITY \& \& returns an \*(AqInfinity\*(Aq number. \& \& NEG_INFINITY \& \& returns a \*(Aq\-Infinity\*(Aq 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 \& \*(Aqtail\*(Aq. \& \& Works in unbounded sets \& \& type($i) \& \& chooses an object data type. \& \& default is none (a normal perl SCALAR). \& \& examples: \& \& type(\*(AqMath::BigFloat\*(Aq); \& type(\*(AqMath::BigInt\*(Aq); \& type(\*(AqSet::Infinite::Date\*(Aq); \& 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 sets .Ve .Sh "Internal functions:" .IX Subsection "Internal functions:" .Vb 1 \& $set\->fixtype; \& \& $set\->numeric; .Ve .SH "CAVEATS" .IX Header "CAVEATS" .Vb 2 \& $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. .Ve .SH "INTERNALS" .IX Header "INTERNALS" The internal representation of a \fIspan\fR is a hash: .PP .Vb 7 \& { a => start of span, \& b => end of span, \& open_begin => \*(Aq0\*(Aq the span starts in \*(Aqa\*(Aq \& \*(Aq1\*(Aq the span starts after \*(Aqa\*(Aq \& open_end => \*(Aq0\*(Aq the span ends in \*(Aqb\*(Aq \& \*(Aq1\*(Aq the span ends before \*(Aqb\*(Aq \& } .Ve .PP For example, this set: .PP .Vb 1 \& [100..200),300,(400..infinity) .Ve .PP is represented by the array of hashes: .PP .Vb 5 \& 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 }, \& ] .Ve .PP The \fIdensity\fR of a set is stored in the \f(CW\*(C`tolerance\*(C'\fR variable: .PP .Vb 1 \& tolerance => 0; # the set is made of real numbers. \& \& tolerance => 1; # the set is made of integers. .Ve .PP The \f(CW\*(C`type\*(C'\fR variable stores the \fIclass\fR of objects that will be stored in the set. .PP .Vb 1 \& type => \*(AqDateTime\*(Aq; # this is a set of DateTime objects .Ve .PP The \fIinfinity\fR value is generated by Perl, when it finds a numerical overflow: .PP .Vb 1 \& $inf = 100**100**100; .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .Vb 1 \& Set::Infinite .Ve .SH "AUTHOR" .IX Header "AUTHOR" .Vb 1 \& Flavio S. Glock .Ve