Set::I...rrence(3pm)

πŸ’… Set::Infinite::_recurrence β€” the glow-up ✨

okay so bestie, this is the tea: it's Set::Infinite::_recurrence from the Perl User Contributed Documentation, dated 2026-02-15, version perl v5.42.2. it's an internal module, and we're gonna get into it.


🌸 NAME 🌸

Set::Infinite::_recurrence β€” literally extends Set::Infinite with recurrence functions. that's the whole vibe. periodt.


πŸŽ€ SYNOPSIS πŸŽ€

$recurrence = $base_set->_recurrence ( \&next, \&previous );

like, that's the one-liner. chef's kiss.


πŸ¦‹ DESCRIPTION πŸ¦‹

bestie, listen. this is an internal class used by the DateTime::Set module. and the API? it's subject to change. so don't get too attached, okay? it's giving "we're not official yet."

what it does tho? it provides all the functionality that Set::Infinite has, plus it adds the ability to define recurrences with arbitrary objects β€” like dates and stuff. it ate, honestly. πŸ”₯


✨ METHODS ✨

πŸ’– _recurrence ( \&next, \&previous ) πŸ’–

creates a recurrence set. and where does this set live? inside a 'base set', obviously. iconic behavior.

$recurrence = $base_set->_recurrence ( \&next, \&previous );

so these recurrence functions β€” they take one argument, and they return either the 'next' occurrence or the 'previous' occurrence. one job, and they do it.

example time, because i know you need one. this defines the set of all 'integer numbers':

use strict;

use Set::Infinite::_recurrence;
use POSIX qw(floor);

# define the recurrence span
my $forever = Set::Infinite::_recurrence->new(
    Set::Infinite::_recurrence::NEG_INFINITY,
    Set::Infinite::_recurrence::INFINITY
);

my $recurrence = $forever->_recurrence(
    sub {   # next
            floor( $_[0] + 1 )
        },
    sub {   # previous
            my $tmp = floor( $_[0] );
            $tmp < $_[0] ? $tmp : $_[0] - 1
        },
);

print "sample recurrence ",
      $recurrence->intersection( -5, 5 ), "\n";
# sample recurrence -5,-4,-3,-2,-1,0,1,2,3,4,5

{
    my $x = 234.567;
    print "next occurrence after $x = ",
          $recurrence->{param}[0]->( $x ), "\n";  # 235
    print "previous occurrence before $x = ",
          $recurrence->{param}[2]->( $x ), "\n";  # 234
}

{
    my $x = 234;
    print "next occurrence after $x = ",
          $recurrence->{param}[0]->( $x ), "\n";  # 235
    print "previous occurrence before $x = ",
          $recurrence->{param}[2]->( $x ), "\n";  # 233
}

like, look at it go. the outputs are right there in the comments β€” # 235, # 234, # 235, # 233. no cap, it's all laid out. 🫢

πŸ’€ is_forever πŸ’€

returns true if the set is a single span, ranging from -Infinity to Infinity. like, it goes on forever and ever, bestie. main character energy. ♾️

🌈 _is_recurrence 🌈

returns true if the set is an unbounded recurrence, ranging from -Infinity to Infinity. same energy, different check. slay.


πŸ‘‘ CONSTANTS πŸ‘‘

⭐ INFINITY ⭐

the "Infinity" value. that's it. that's the whole description. it's literally infinite and it knows it.

πŸŒ™ NEG_INFINITY πŸŒ™

the "-Infinity" value. the negative version. the other side of the coin. still iconic.


πŸ’Œ SUPPORT πŸ’Œ

support is offered through the "datetime@perl.org" mailing list. so if you're stuck, that's where to go. and please β€” please β€” report bugs using rt.cpan.org. they want to know. fr fr. πŸ›


🧚 AUTHOR 🧚

Flavio Soibelmann Glock <fglock@gmail.com> β€” the author. give them their flowers. πŸ’

and the recurrence generation algorithm? it's based on an idea from Dave Rolsky. so double the credit. respect. 🫑


copyright (c) 2003 Flavio Soibelmann Glock. all rights reserved. this program is free software; you can distribute it and/or modify it under the same terms as Perl itself. so like, go off, but read the terms first.

the full text of the license can be found in the LICENSE file included with this module. it's all documented, bestie. no surprises.


πŸ”— SEE ALSO πŸ”—

  • Set::Infinite β€” the parent module, the origin story.
  • DateTime::Set β€” the module that uses this one, the reason it exists.

and for details on the Perl DateTime Suite project, please see <http://datetime.perl.org>. go explore, it's a whole world. 🌍


and that's the whole manpage, bestie! πŸ’– this was Set::Infinite::_recurrence β€” internal, subject to change, but absolutely serving. stay slay, and remember: perl v5.42.2, 2026-02-15. you're welcome. πŸŽ€βœ¨

πŸ“¦ where this page comes from