1Math::NumSeq::Base::IteUrsaetrePCroendt(r3i)buted Perl DMoactuhm:e:nNtuamtSieoqn::Base::IteratePred(3)
2
3
4
6 Math::NumSeq::Base::IteratePred -- iterate by searching with pred()
7
9 package MyNumSeqSubclass;
10 use Math::NumSeq;
11 use Math::NumSeq::Base::IteratePred;
12 @ISA = ('Math::NumSeq::Base::IteratePred',
13 'Math::NumSeq');
14 sub ith {
15 my ($self, $i) = @_;
16 return something($i);
17 }
18
20 This is a multi-inheritance mix-in providing the following methods
21
22 rewind() # return to $self->i_start() and $self->values_min()
23 next() # search using $self->pred()
24
25 characteristic_increasing() # always true
26 characteristic_integer() # always true
27
28 "next()" iterates by searching for values satisfying
29 "$self->pred($value)", starting at "values_min()" and stepping by 1
30 each time.
31
32 This is a handy way to implement the iterating methods for a "NumSeq"
33 if there's no easy way to step or have random access to values, only a
34 test of a condition.
35
36 The current implementation is designed for infinite sequences, it
37 doesn't check for a "values_max()" limit.
38
39 The two "characteristic" methods mean that calls
40
41 $self->characteristic('increasing')
42 $self->characteristic('integer')
43
44 are both true. "Increasing" is since "next()" always searches upwards.
45 "Integer" currently presumes that the starting "values_min()" is an
46 integer.
47
49 Math::NumSeq
50
52 <http://user42.tuxfamily.org/math-numseq/index.html>
53
55 Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
56
57 Math-NumSeq is free software; you can redistribute it and/or modify it
58 under the terms of the GNU General Public License as published by the
59 Free Software Foundation; either version 3, or (at your option) any
60 later version.
61
62 Math-NumSeq is distributed in the hope that it will be useful, but
63 WITHOUT ANY WARRANTY; without even the implied warranty of
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
65 General Public License for more details.
66
67 You should have received a copy of the GNU General Public License along
68 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
69
70
71
72perl v5.34.1 2022-06-06Math::NumSeq::Base::IteratePred(3)