The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

        Set::Infinite::Simple - an interval of 2 scalars

SYNOPSIS

        This is a building block for Set::Infinite.
        Please use Set::Infinite instead.

        use Set::Infinite::Simple;

        $a = Set::Infinite::Simple->new(1,2);
        print $a->union(5,6);

USAGE

        $a = Set::Infinite::Simple->new();
        $a = Set::Infinite::Simple->new(1);
        $a = Set::Infinite::Simple->new(1,2);
        $a = Set::Infinite::Simple->new('2001-10-10','2001-10-20', 'Set::Infinite::Date'); # 'type' parameter

        $a = Set::Infinite::Simple->new(@b);    
        $a = Set::Infinite::Simple->new($b);    
                parameters can be:
                undef
                SCALAR => means a set like [1]
                SCALAR,SCALAR
                ARRAY of SCALAR
                Set::Infinite::Simple

        $logic = $a->intersects($b);
        $logic = $a->contains($b);

        $i = $a->union($b);     
                NOTE: union returns a list if result is ($a, $b)
        $i = $a->intersection($b);
        $i = $a->complement($b);
        $i = $a->complement;

        @b = sort @a;
        print $a;

        tie $a, 'Set::Infinite::Simple', 1,2;
                SCALAR behaves like a string "min .. max"
        tie @a, 'Set::Infinite::Simple', 1,2;
                $a[0], $a[1] are min and max
                POP, PUSH, SHIFT, UNSHIFT, SPLICE, DELETE, and EXISTS are not defined

        $a->open_end(1)         open-end: elements are < end
        $a->open_begin(1)       open-start: elements are > begin
        $a->open_end(0)         close-end: elements are <= end
        $a->open_begin(0)       close-start: elements are >= begin

Global: separators(@i) chooses the separators. default are [ ] ( ) '..' ','.

        infinite                returns an 'infinity' number.
        minus_infinite  returns '- infinity' number.
        null                    returns 'null'.

Internal:

        $a = Set::Infinite::Simple->fastnew( object_begin, object_end, open_begin, open_end );  

CHANGES

        'new' parameter 'type'

moved to Set::Infinite.pm in version 0.30:

        tolerance
        real            
        integer         
        type

removed in version 0.30:

        tie
        add

TODO

        formatted string input like '[0..1]'

AUTHOR

        Flavio Soibelmann Glock <fglock@pucrs.br>