Math::N...ratePred(3)
π Math::NumSeq::Base::IteratePred β the perl manpage, but make it make sense π
okay bestie, so this is a page from the User Contributed Perl Documentation, section 3 (that's the library-functions section, iykyk), and the module we're talking about is Math::NumSeq::Base::IteratePred. yes the title got chopped up in the header, that's just how the man page renderer do. the real name is right there. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
Math::NumSeq::Base::IteratePred β iterate by searching with pred()
like, that's the whole vibe. you don't know how to step through your sequence? no problem. you just search for the next one. iconic behavior honestly.
πΈ SYNOPSIS πΈ
here's the setup, copy it exactly, don't freestyle the syntax bestie:
package MyNumSeqSubclass;
use Math::NumSeq;
use Math::NumSeq::Base::IteratePred;
@ISA = ('Math::NumSeq::Base::IteratePred',
'Math::NumSeq');
sub ith {
my ($self, $i) = @_;
return something($i);
}
see how it's doing the multiple-inheritance thing? @ISA got two parents, and it's thriving. one of them is this mix-in, the other is Math::NumSeq. they co-parent. π
π¦ DESCRIPTION π¦
so this is a multi-inheritance mix-in, and what it does is hand you these methods:
rewind() # return to $self->i_start() and $self->values_min()
next() # search using $self->pred()
characteristic_increasing() # always true
characteristic_integer() # always true
okay so next() β the way that it works β it iterates by searching for values that satisfy "$self->pred($value)", starting at values_min() and stepping by 1 each time. literally just going up one by one, checking the vibe of each number. no cap.
this is a handy way to implement the iterating methods for a "NumSeq" if there's no easy way to step or have random access to values, only a test of a condition. like, you can't jump around, you can't do the fancy index math, all you've got is a yes/no test. and that's fine!! this mix-in eats that for breakfast. π
β οΈ okay important thing, no skipping: the current implementation is designed for infinite sequences, it doesn't check for a values_max() limit. so like. it will not stop. it will just keep going. it's giving main character who never learned when to leave the party. π
the two "characteristic" methods mean that calls
$self->characteristic('increasing')
$self->characteristic('integer')
are both true.
"Increasing"is sincenext()always searches upwards. always. up up up. π"Integer"currently presumes that the startingvalues_min()is an integer. that's the assumption it's running with, periodt.
π SEE ALSO π
Math::NumSeq β the parent, the blueprint, the whole reason we're here π
π HOME PAGE π
<http://user42.tuxfamily.org/math-numseq/index.html>
go look, it's the source of truth, don't @ me.
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
Math-NumSeq is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-NumSeq is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
π yes the all-caps parts are real and yes you should read them, that's the legal equivalent of "no take-backs" and it means it.
that's the whole page bestie, you made it, I'm so proud π₯Ήβ¨
this lil tour was brought to you by perl v5.42.0, dated 2025-07-25, and it's the Math::NumSeq::Base::IteratePred(3) page β drink some water, go write a subclass, you've got this ππΈπ¦
π¦ where this page comes from
- fedora 43: perl-Math-NumSeq 75-11.fc43 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms