1Math::NumSeq::Base::IteUrsaetreICtohn(t3r)ibuted Perl DoMcautmhe:n:tNautmiSoenq::Base::IterateIth(3)
2
3
4
6 Math::NumSeq::Base::IterateIth -- iterate by calling ith() successively
7
9 package MyNumSeqSubclass;
10 use Math::NumSeq;
11 use Math::NumSeq::Base::IterateIth;
12 @ISA = ('Math::NumSeq::Base::IterateIth',
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()
23 next()
24 seek_to_i()
25
26 They iterate simply by calling "ith()" to get each successive value,
27 starting from "i_start()".
28
29 This is a handy way to implement the iterating methods for a "NumSeq"
30 if there's nothing special that "next()" can do beyond a full "ith()"
31 calculation.
32
33 If "ith()" returns "undef" then that's taken to be the end of the
34 sequence and "next()" returns no values.
35
37 Math::NumSeq
38
40 <http://user42.tuxfamily.org/math-numseq/index.html>
41
43 Copyright 2011, 2012, 2013, 2014, 2016, 2019 Kevin Ryde
44
45 Math-NumSeq is free software; you can redistribute it and/or modify it
46 under the terms of the GNU General Public License as published by the
47 Free Software Foundation; either version 3, or (at your option) any
48 later version.
49
50 Math-NumSeq is distributed in the hope that it will be useful, but
51 WITHOUT ANY WARRANTY; without even the implied warranty of
52 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
53 General Public License for more details.
54
55 You should have received a copy of the GNU General Public License along
56 with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
57
58
59
60perl v5.34.0 2021-07-22 Math::NumSeq::Base::IterateIth(3)